|
//------------------------------------------------------------------------------
#include "stdafx.h"
#include "Singleton.h"
#include "SingletonDlg.h"
//------------------------------------------------------------------------------
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
//------------------------------------------------------------------------------
BEGIN_MESSAGE_MAP(CSingletonApp, CWinApp)
END_MESSAGE_MAP()
//------------------------------------------------------------------------------
CSingletonApp theApp;
//------------------------------------------------------------------------------
CSingletonApp::CSingletonApp()
{
}
//------------------------------------------------------------------------------
CSingletonApp::~CSingletonApp()
{
}
//------------------------------------------------------------------------------
void CSingletonApp::WakeUp ( LPCTSTR aCommandLine ) const
// Name: WakeUp
// Type: Function
// Description: virtual override for wake up, so we can process the command line
{
// Call parent class to handle the basic functionality
CSingleInstance::WakeUp ( aCommandLine ) ;
// Send new command line to the dialog
CSingletonDlg* lSingletonDlg = (CSingletonDlg*) m_pMainWnd ;
if ( lSingletonDlg )
{
lSingletonDlg -> SetCommandLine ( aCommandLine ) ;
}
}
//------------------------------------------------------------------------------
BOOL CSingletonApp::InitInstance()
{
// We use a GUID here, so that we are sure the string is 100% unique
if ( CSingleInstance::Create ( _T("E435FC13-82C1-4f80-97C5-006FF4A4E302") ) == FALSE )
return FALSE ;
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
// Call this when using MFC in a shared DLL
Enable3dControls () ;
#else
// Call this when linking to MFC statically
Enable3dControlsStatic () ;
#endif
CSingletonDlg lSingletonDlg ;
m_pMainWnd = &lSingletonDlg ;
lSingletonDlg . DoModal () ;
// Since the dialog has been closed, return FALSE so that we exit the
// application, rather than start the application's message pump.
return FALSE ;
}
//------------------------------------------------------------------------------
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
Developing windows applications for over 15 years now starting on Win 3.1 with Object Oriented Pascal, progressed to C++ and OWL, in 1996 switch to MFC and never looked back, now focusing on .NET/Mono.