Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

92 lines
2.3 KiB

  1. // LexEdit_1.cpp : Defines the entry point for the application.
  2. //
  3. #include "StdAfx.h"
  4. #include "resource.h"
  5. int APIENTRY WinMain(HINSTANCE hInstance,
  6. HINSTANCE hPrevInstance,
  7. LPSTR lpCmdLine,
  8. int nCmdShow);
  9. int APIENTRY WinMain(HINSTANCE hInstance,
  10. HINSTANCE hPrevInstance,
  11. LPSTR lpCmdLine,
  12. int nCmdShow)
  13. {
  14. HACCEL hAccel;
  15. HWND hWnd = NULL;
  16. MSG msg;
  17. WNDCLASSEX wc;
  18. HRESULT hr = S_OK;
  19. // Store the global instance
  20. g_hInst = hInstance;
  21. // Initialize the Win95 control library
  22. InitCommonControls();
  23. // Initialize COM
  24. CoInitialize(NULL);
  25. // Register the main dialog class
  26. ZeroMemory( &wc, sizeof(wc) );
  27. wc.cbSize = sizeof( wc );
  28. GetClassInfoEx( NULL, WC_DIALOG, &wc );
  29. wc.lpfnWndProc = DlgProcMain;
  30. wc.hInstance = hInstance;
  31. wc.hCursor = LoadCursor( NULL, IDC_ARROW );
  32. wc.hbrBackground = GetSysColorBrush( COLOR_3DFACE );
  33. wc.lpszMenuName = NULL;
  34. wc.hIcon = LoadIcon( hInstance, MAKEINTRESOURCE(IDI_APPICON) );
  35. wc.hIconSm = LoadIcon( hInstance, MAKEINTRESOURCE(IDI_APPICON) );
  36. if(!RegisterClassEx(&wc))
  37. goto exit;
  38. //--- Create the default voice and get the TTS default wave format
  39. hr = cpVoice.CoCreateInstance( CLSID_SpVoice );
  40. if (FAILED(hr))
  41. goto exit;
  42. // Create the main dialog
  43. g_hDlg = CreateDialog( hInstance, MAKEINTRESOURCE(IDD_MAIN),
  44. NULL, (DLGPROC)DlgProcMain );
  45. // If we didn't get our dialogs, we need to bail.
  46. if( !g_hDlg )
  47. goto exit;
  48. // Make the main dialog visible
  49. ShowWindow(g_hDlg, SW_RESTORE);
  50. UpdateWindow(g_hDlg);
  51. hAccel = LoadAccelerators( hInstance, MAKEINTRESOURCE(IDR_ACCELERATOR1) );
  52. // Enter the message loop
  53. while(GetMessage(&msg, NULL, 0, 0) > 0)
  54. {
  55. if (!TranslateAccelerator (g_hDlg, hAccel, &msg))
  56. {
  57. TranslateMessage(&msg);
  58. DispatchMessage(&msg);
  59. }
  60. }
  61. exit:
  62. // Free the dialogs
  63. DestroyWindow(g_hDlg);
  64. cpVoice.Release();
  65. // Unload COM
  66. CoUninitialize();
  67. // Return 0
  68. return 0;
  69. }