2007-03-27 17:47:10 +00:00
|
|
|
/*
|
|
|
|
* CiderPress
|
|
|
|
* Copyright (C) 2007 by faddenSoft, LLC. All Rights Reserved.
|
|
|
|
* See the file LICENSE for distribution terms.
|
|
|
|
*/
|
|
|
|
/*
|
|
|
|
* The application object.
|
|
|
|
*/
|
|
|
|
#include "stdafx.h"
|
|
|
|
#include "mdc.h"
|
|
|
|
#include "Main.h"
|
|
|
|
#include <process.h>
|
|
|
|
|
|
|
|
/* magic global that MFC finds (or that finds MFC) */
|
|
|
|
MyApp gMyApp;
|
|
|
|
|
2014-11-18 01:54:34 +00:00
|
|
|
DebugLog* gDebugLog;
|
2007-03-27 17:47:10 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Constructor. This is the closest thing to "main" that we have, but we
|
|
|
|
* should wait for InitInstance for most things.
|
|
|
|
*/
|
|
|
|
MyApp::MyApp(LPCTSTR lpszAppName) : CWinApp(lpszAppName)
|
|
|
|
{
|
2014-11-18 01:54:34 +00:00
|
|
|
// TODO: make the log file configurable
|
|
|
|
gDebugLog = new DebugLog(L"C:\\src\\mdclog.txt");
|
2007-03-27 17:47:10 +00:00
|
|
|
|
2014-11-18 05:13:13 +00:00
|
|
|
time_t now = time(NULL);
|
2014-11-18 21:05:15 +00:00
|
|
|
LOGI("MDC v%d.%d.%d started at %.24hs",
|
2014-11-18 01:54:34 +00:00
|
|
|
kAppMajorVersion, kAppMinorVersion, kAppBugVersion,
|
|
|
|
ctime(&now));
|
2007-03-27 17:47:10 +00:00
|
|
|
|
2014-11-04 00:26:53 +00:00
|
|
|
int tmpDbgFlag;
|
|
|
|
// enable memory leak detection
|
2007-03-27 17:47:10 +00:00
|
|
|
tmpDbgFlag = _CrtSetDbgFlag(_CRTDBG_REPORT_FLAG);
|
|
|
|
tmpDbgFlag |= _CRTDBG_LEAK_CHECK_DF;
|
|
|
|
_CrtSetDbgFlag(tmpDbgFlag);
|
2014-11-18 21:05:15 +00:00
|
|
|
LOGI("Leak detection enabled");
|
2007-03-27 17:47:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* This is the last point of control we have.
|
|
|
|
*/
|
|
|
|
MyApp::~MyApp(void)
|
|
|
|
{
|
2014-12-02 06:07:39 +00:00
|
|
|
LOGI("MDC shutting down");
|
2014-11-18 01:54:34 +00:00
|
|
|
delete gDebugLog;
|
2007-03-27 17:47:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* It all begins here.
|
|
|
|
*
|
|
|
|
* Create a main window.
|
|
|
|
*/
|
|
|
|
BOOL
|
|
|
|
MyApp::InitInstance(void)
|
|
|
|
{
|
2014-11-04 00:26:53 +00:00
|
|
|
m_pMainWnd = new MainWindow;
|
|
|
|
m_pMainWnd->ShowWindow(m_nCmdShow);
|
|
|
|
m_pMainWnd->UpdateWindow();
|
2007-03-27 17:47:10 +00:00
|
|
|
|
2014-11-04 00:26:53 +00:00
|
|
|
return TRUE;
|
2007-03-27 17:47:10 +00:00
|
|
|
}
|