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.

108 lines
2.2 KiB

  1. /*++
  2. Copyright (c) 1996 Microsoft Corporation
  3. Module Name:
  4. Mustard.cpp : implementation file
  5. File History:
  6. JonY Jan-96 created
  7. --*/
  8. #include "stdafx.h"
  9. #include "Mustard.h"
  10. #include "wizlist.h"
  11. #include "Startd.h"
  12. #ifdef _DEBUG
  13. #define new DEBUG_NEW
  14. #undef THIS_FILE
  15. static char THIS_FILE[] = __FILE__;
  16. #endif
  17. /////////////////////////////////////////////////////////////////////////////
  18. // CMustardApp
  19. BEGIN_MESSAGE_MAP(CMustardApp, CWinApp)
  20. //{{AFX_MSG_MAP(CMustardApp)
  21. //}}AFX_MSG
  22. ON_COMMAND(ID_HELP, CWinApp::OnHelp)
  23. END_MESSAGE_MAP()
  24. /////////////////////////////////////////////////////////////////////////////
  25. // CMustardApp construction
  26. BOOL CMustardApp::IsSecondInstance()
  27. {
  28. HANDLE hSem;
  29. //create a semaphore object with max count of 1
  30. hSem = CreateSemaphore(NULL, 0, 1, L"Wizmgr Semaphore");
  31. if (hSem!=NULL && GetLastError() == ERROR_ALREADY_EXISTS) {
  32. CloseHandle(hSem);
  33. CString csAppName;
  34. csAppName.LoadString(AFX_IDS_APP_TITLE);
  35. CWnd* pWnd = CWnd::FindWindow(NULL, (LPCTSTR)csAppName);
  36. if (pWnd)
  37. {
  38. pWnd->ShowWindow(SW_RESTORE);
  39. }
  40. return TRUE;
  41. }
  42. return FALSE;
  43. }
  44. CMustardApp::CMustardApp()
  45. {
  46. }
  47. /////////////////////////////////////////////////////////////////////////////
  48. // The one and only CMustardApp object
  49. CMustardApp theApp;
  50. /////////////////////////////////////////////////////////////////////////////
  51. // CMustardApp initialization
  52. BOOL CMustardApp::InitInstance()
  53. {
  54. if (IsSecondInstance())
  55. return FALSE;
  56. // check for OS version
  57. OSVERSIONINFO os;
  58. os.dwOSVersionInfoSize = sizeof(os);
  59. GetVersionEx(&os);
  60. if (os.dwMajorVersion < 4)
  61. {
  62. AfxMessageBox(IDS_BAD_VERSION, MB_ICONSTOP);
  63. ExitProcess(0);
  64. }
  65. // Standard initialization
  66. #ifdef _AFXDLL
  67. Enable3dControls(); // Call this when using MFC in a shared DLL
  68. #else
  69. Enable3dControlsStatic(); // Call this when linking to MFC statically
  70. #endif
  71. CStartD dlg;
  72. m_pMainWnd = &dlg;
  73. INT_PTR nResponse = dlg.DoModal();
  74. if (nResponse == IDOK)
  75. {
  76. }
  77. else if (nResponse == IDCANCEL)
  78. {
  79. }
  80. // Since the dialog has been closed, return FALSE so that we exit the
  81. // application, rather than start the application's message pump.
  82. return FALSE;
  83. }