Old fashion design for PC-104
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.

125 lines
3.3 KiB

4 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. //----------------------------------------------------------------------------
  2. // Laser Guard Ltd.
  3. // Copyright � 2000-2002. All Rights Reserved.
  4. // Version 1.0 01/01/2000
  5. // Last modification: 08/10/2003
  6. // PROJECT:
  7. // SUBSYSTEM:
  8. // FILE: Chicago.cpp
  9. // AUTHOR: Sergey Chizhevskiy
  10. // OVERVIEW
  11. // ~~~~~~~~
  12. // Source file of Chicago.cpp
  13. //----------------------------------------------------------------------------
  14. // Chicago.cpp : Defines the class behaviors for the application.
  15. //
  16. #include "stdafx.h"
  17. #include "Chicago.h"
  18. #include "ChicagoDlg.h"
  19. #include "..\..\LgLib\Version.h"
  20. #include "..\..\LgLib\LgInstanceLock.h"
  21. #include "..\..\LgLib\LgPowerLock.h"
  22. #ifdef _DEBUG
  23. #define new DEBUG_NEW
  24. #undef THIS_FILE
  25. static char THIS_FILE[] = __FILE__;
  26. #endif
  27. /////////////////////////////////////////////////////////////////////////////
  28. // CChicagoApp
  29. BEGIN_MESSAGE_MAP(CChicagoApp, CWinApp)
  30. //{{AFX_MSG_MAP(CChicagoApp)
  31. // NOTE - the ClassWizard will add and remove mapping macros here.
  32. // DO NOT EDIT what you see in these blocks of generated code!
  33. //}}AFX_MSG
  34. ON_COMMAND(ID_HELP, CWinApp::OnHelp)
  35. END_MESSAGE_MAP()
  36. /////////////////////////////////////////////////////////////////////////////
  37. // CChicagoApp construction
  38. CChicagoApp::CChicagoApp()
  39. {
  40. m_bRestart = FALSE;
  41. LGLOG( LOG_LEVEL_MEDIUM, LOG_TYPE_INFO, this, _T("CChicagoApp::CChicagoApp") );
  42. }
  43. /////////////////////////////////////////////////////////////////////////////
  44. // The one and only CChicagoApp object
  45. CChicagoApp theApp;
  46. /////////////////////////////////////////////////////////////////////////////
  47. // CChicagoApp initialization
  48. BOOL CChicagoApp::InitInstance()
  49. {
  50. // lock instance
  51. #ifndef _DEBUG
  52. CLgInstanceLock InstanceLock;
  53. if( !InstanceLock.Lock( "LASER_GUARD_ISSC_INSTANCE_LOCK_MUTEX" ) )
  54. {
  55. ::MessageBox( NULL, "Another copy of program already started!", NULL, MB_OK | MB_ICONEXCLAMATION );
  56. return FALSE;
  57. }
  58. CLgPowerLock PowerLock;
  59. PowerLock.Lock();
  60. #endif
  61. AfxEnableControlContainer();
  62. // Standard initialization
  63. // If you are not using these features and wish to reduce the size
  64. // of your final executable, you should remove from the following
  65. // the specific initialization routines you do not need.
  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. CChicagoDlg *pDlg = new CChicagoDlg;
  72. if( !pDlg )
  73. return FALSE;
  74. m_pMainWnd = pDlg;
  75. int nResponse = pDlg->DoModal();
  76. if (nResponse == IDOK)
  77. {
  78. // TODO: Place code here to handle when the dialog is
  79. // dismissed with OK
  80. }
  81. else if (nResponse == IDCANCEL)
  82. {
  83. // TODO: Place code here to handle when the dialog is
  84. // dismissed with Cancel
  85. }
  86. // Since the dialog has been closed, return FALSE so that we exit the
  87. // application, rather than start the application's message pump.
  88. delete pDlg;
  89. if( m_bRestart )
  90. {
  91. #ifndef _DEBUG
  92. // unlock curent instance
  93. InstanceLock.Unlock();
  94. #endif
  95. // start new instance
  96. TCHAR pName[MAX_PATH];
  97. ::GetModuleFileName( NULL, pName, MAX_PATH );
  98. ::ShellExecute( NULL, _T("open"), ::PathFindFileName( pName ), this->m_lpCmdLine, _T(""), SW_SHOW );
  99. }
  100. return FALSE;
  101. }
  102. void CChicagoApp::SetRestart()
  103. {
  104. m_bRestart = TRUE;
  105. }