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
125 lines
3.3 KiB
//----------------------------------------------------------------------------
|
|
// Laser Guard Ltd.
|
|
// Copyright © 2000-2002. All Rights Reserved.
|
|
// Version 1.0 01/01/2000
|
|
// Last modification: 08/10/2003
|
|
// PROJECT:
|
|
// SUBSYSTEM:
|
|
// FILE: Chicago.cpp
|
|
// AUTHOR: Sergey Chizhevskiy
|
|
// OVERVIEW
|
|
// ~~~~~~~~
|
|
// Source file of Chicago.cpp
|
|
//----------------------------------------------------------------------------
|
|
// Chicago.cpp : Defines the class behaviors for the application.
|
|
//
|
|
|
|
#include "stdafx.h"
|
|
#include "Chicago.h"
|
|
#include "ChicagoDlg.h"
|
|
#include "..\..\LgLib\Version.h"
|
|
#include "..\..\LgLib\LgInstanceLock.h"
|
|
#include "..\..\LgLib\LgPowerLock.h"
|
|
|
|
#ifdef _DEBUG
|
|
#define new DEBUG_NEW
|
|
#undef THIS_FILE
|
|
static char THIS_FILE[] = __FILE__;
|
|
#endif
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
// CChicagoApp
|
|
|
|
BEGIN_MESSAGE_MAP(CChicagoApp, CWinApp)
|
|
//{{AFX_MSG_MAP(CChicagoApp)
|
|
// NOTE - the ClassWizard will add and remove mapping macros here.
|
|
// DO NOT EDIT what you see in these blocks of generated code!
|
|
//}}AFX_MSG
|
|
ON_COMMAND(ID_HELP, CWinApp::OnHelp)
|
|
END_MESSAGE_MAP()
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
// CChicagoApp construction
|
|
CChicagoApp::CChicagoApp()
|
|
{
|
|
m_bRestart = FALSE;
|
|
|
|
LGLOG( LOG_LEVEL_MEDIUM, LOG_TYPE_INFO, this, _T("CChicagoApp::CChicagoApp") );
|
|
}
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
// The one and only CChicagoApp object
|
|
|
|
CChicagoApp theApp;
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
// CChicagoApp initialization
|
|
|
|
BOOL CChicagoApp::InitInstance()
|
|
{
|
|
// lock instance
|
|
#ifndef _DEBUG
|
|
CLgInstanceLock InstanceLock;
|
|
if( !InstanceLock.Lock( "LASER_GUARD_ISSC_INSTANCE_LOCK_MUTEX" ) )
|
|
{
|
|
::MessageBox( NULL, "Another copy of program already started!", NULL, MB_OK | MB_ICONEXCLAMATION );
|
|
return FALSE;
|
|
}
|
|
|
|
CLgPowerLock PowerLock;
|
|
PowerLock.Lock();
|
|
#endif
|
|
|
|
AfxEnableControlContainer();
|
|
|
|
// Standard initialization
|
|
// If you are not using these features and wish to reduce the size
|
|
// of your final executable, you should remove from the following
|
|
// the specific initialization routines you do not need.
|
|
|
|
#ifdef _AFXDLL
|
|
Enable3dControls(); // Call this when using MFC in a shared DLL
|
|
#else
|
|
Enable3dControlsStatic(); // Call this when linking to MFC statically
|
|
#endif
|
|
CChicagoDlg *pDlg = new CChicagoDlg;
|
|
if( !pDlg )
|
|
return FALSE;
|
|
|
|
m_pMainWnd = pDlg;
|
|
int nResponse = pDlg->DoModal();
|
|
|
|
if (nResponse == IDOK)
|
|
{
|
|
// TODO: Place code here to handle when the dialog is
|
|
// dismissed with OK
|
|
}
|
|
else if (nResponse == IDCANCEL)
|
|
{
|
|
// TODO: Place code here to handle when the dialog is
|
|
// dismissed with Cancel
|
|
}
|
|
// Since the dialog has been closed, return FALSE so that we exit the
|
|
// application, rather than start the application's message pump.
|
|
delete pDlg;
|
|
|
|
if( m_bRestart )
|
|
{
|
|
#ifndef _DEBUG
|
|
// unlock curent instance
|
|
InstanceLock.Unlock();
|
|
#endif
|
|
|
|
// start new instance
|
|
TCHAR pName[MAX_PATH];
|
|
::GetModuleFileName( NULL, pName, MAX_PATH );
|
|
::ShellExecute( NULL, _T("open"), ::PathFindFileName( pName ), this->m_lpCmdLine, _T(""), SW_SHOW );
|
|
}
|
|
|
|
|
|
return FALSE;
|
|
}
|
|
|
|
void CChicagoApp::SetRestart()
|
|
{
|
|
m_bRestart = TRUE;
|
|
}
|