Leaked source code of windows server 2003
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.

141 lines
3.2 KiB

  1. /*++
  2. Copyright (c) Microsoft Corporation. All rights reserved.
  3. Module Name:
  4. Winmain.cpp
  5. Abstract:
  6. Implements the entry point for the application.
  7. Notes:
  8. ANSI only - must run on Win9x.
  9. History:
  10. 01/30/01 rparsons Created
  11. 01/10/02 rparsons Revised
  12. --*/
  13. #include "demoapp.h"
  14. //
  15. // This structure contains everything we'll need throughout
  16. // the application.
  17. //
  18. APPINFO g_ai;
  19. /*++
  20. Routine Description:
  21. Application entry point.
  22. Arguments:
  23. hInstance - App instance handle.
  24. hPrevInstance - Always NULL.
  25. lpCmdLine - Pointer to the command line.
  26. nCmdShow - Window show flag.
  27. Return Value:
  28. The wParam member of the message structure.
  29. --*/
  30. int
  31. APIENTRY
  32. WinMain(
  33. IN HINSTANCE hInstance,
  34. IN HINSTANCE hPrevInstance,
  35. IN LPSTR lpCmdLine,
  36. IN int nCmdShow
  37. )
  38. {
  39. MSG msg;
  40. HWND hWnd;
  41. HANDLE hThread;
  42. char szError[MAX_PATH];
  43. UINT threadId = 0;
  44. g_ai.hInstance = hInstance;
  45. //
  46. // Do some init stuff.
  47. //
  48. if (!DemoAppInitialize(lpCmdLine)) {
  49. return 0;
  50. }
  51. //
  52. // Determine if we should run the normal app or the setup app.
  53. //
  54. if (g_ai.fRunApp) {
  55. //
  56. // Create the main window and kick off the message loop.
  57. //
  58. if (!InitMainApplication(hInstance)) {
  59. return 0;
  60. }
  61. if (!InitMainInstance(hInstance, nCmdShow)) {
  62. return 0;
  63. }
  64. } else {
  65. LoadString(g_ai.hInstance, IDS_DEMO_ONLY, szError, sizeof(szError));
  66. MessageBox(NULL,
  67. szError,
  68. MAIN_APP_TITLE,
  69. MB_TOPMOST | MB_ICONEXCLAMATION);
  70. //
  71. // Create a thread to handle the splash screen and the extraction
  72. // dialog.
  73. //
  74. hThread = (HANDLE)_beginthreadex(NULL,
  75. 0,
  76. &InitSetupThread,
  77. NULL,
  78. 0,
  79. &threadId);
  80. WaitForSingleObject(hThread, INFINITE);
  81. CloseHandle(hThread);
  82. //
  83. // If we're allowed, perform our version check!!!!
  84. //
  85. if (g_ai.fEnableBadFunc) {
  86. if (!BadIsWindows95()) {
  87. LoadString(g_ai.hInstance, IDS_NOT_WIN95, szError, sizeof(szError));
  88. MessageBox(NULL,
  89. szError,
  90. 0,
  91. MB_ICONERROR | MB_TOPMOST);
  92. return 0;
  93. }
  94. }
  95. //
  96. // Create our full screen window and paint the background teal.
  97. //
  98. hWnd = CreateFullScreenWindow();
  99. if (!hWnd) {
  100. return 0;
  101. }
  102. }
  103. while (GetMessage(&msg, (HWND)NULL, 0, 0)) {
  104. if (!IsDialogMessage(hWnd, &msg)) {
  105. TranslateMessage(&msg);
  106. DispatchMessage(&msg);
  107. }
  108. }
  109. return msg.wParam;
  110. }