129 lines
3.4 KiB
C++
129 lines
3.4 KiB
C++
//------------------------------------------------------------------------
|
|
//
|
|
// File: shell\themes\test\ctlperf\CtlPerf.cpp
|
|
//
|
|
// Contents: Main source file for CtlPerf.exe
|
|
// This file was generated by the WTL app wizard.
|
|
//
|
|
// Classes: None
|
|
//
|
|
//------------------------------------------------------------------------
|
|
#include "stdafx.h"
|
|
|
|
#include <atlframe.h>
|
|
|
|
#include "resource.h"
|
|
|
|
#include "CtlPerfView.h"
|
|
#include "aboutdlg.h"
|
|
#include "MainFrm.h"
|
|
|
|
CAppModule _Module;
|
|
|
|
//------------------------------------------------------------------------
|
|
//
|
|
// Function: Run
|
|
//
|
|
// Synopsis: Create main window and start message loop
|
|
//
|
|
//------------------------------------------------------------------------
|
|
int Run(LPTSTR lpstrCmdLine = NULL, int /*nCmdShow*/ = SW_SHOWDEFAULT)
|
|
{
|
|
CMessageLoop theLoop;
|
|
_Module.AddMessageLoop(&theLoop);
|
|
|
|
CMainFrame wndMain;
|
|
|
|
if(wndMain.CreateEx() == NULL)
|
|
{
|
|
ATLTRACE(_T("Main window creation failed!\n"));
|
|
return 0;
|
|
}
|
|
|
|
wndMain.ShowWindow(SW_MAXIMIZE);
|
|
|
|
//** Parse command line
|
|
if (lpstrCmdLine)
|
|
{
|
|
::CharLower(lpstrCmdLine);
|
|
|
|
LPTSTR p = _tcsstr(lpstrCmdLine, _T("/l"));
|
|
TCHAR pszLogFileName[_MAX_PATH + 1];
|
|
|
|
if(p) // Copy the log file name
|
|
{
|
|
_tcscpy(pszLogFileName, p + 2);
|
|
p = pszLogFileName;
|
|
while (*p && *p != _T(' '))
|
|
{
|
|
p++;
|
|
}
|
|
if (*p)
|
|
{
|
|
*p = _T('\0');
|
|
}
|
|
}
|
|
|
|
// We communicate by messages with the main frame (the only thing we know from here)
|
|
// that will forward to the view
|
|
if (_tcsstr(lpstrCmdLine, _T("1pass")))
|
|
{
|
|
wndMain.PostMessage(WM_COMMAND, IDM_BATCH1, p ? (LPARAM) pszLogFileName : 0);
|
|
}
|
|
else if (_tcsstr(lpstrCmdLine, _T("2pass")))
|
|
{
|
|
if(_tcsstr(lpstrCmdLine, _T("/s")))
|
|
{
|
|
wndMain.PostMessage(WM_COMMAND, IDM_BATCH3, p ? (LPARAM) pszLogFileName : 0);
|
|
}
|
|
else
|
|
{
|
|
wndMain.PostMessage(WM_COMMAND, IDM_BATCH2, p ? (LPARAM) pszLogFileName : 0);
|
|
}
|
|
}
|
|
}
|
|
|
|
int nRet = theLoop.Run();
|
|
|
|
_Module.RemoveMessageLoop();
|
|
return nRet;
|
|
}
|
|
|
|
//------------------------------------------------------------------------
|
|
//
|
|
// Function: _tWinMain
|
|
//
|
|
// Synopsis: Main entry point
|
|
//
|
|
//------------------------------------------------------------------------
|
|
int WINAPI _tWinMain(HINSTANCE hInstance, HINSTANCE /*hPrevInstance*/, LPTSTR lpstrCmdLine, int nCmdShow)
|
|
{
|
|
HRESULT hRes = ::CoInitialize(NULL);
|
|
// If you are running on NT 4.0 or higher you can use the following call instead to
|
|
// make the EXE free threaded. This means that calls come in on a random RPC thread.
|
|
// HRESULT hRes = ::CoInitializeEx(NULL, COINIT_MULTITHREADED);
|
|
ATLASSERT(SUCCEEDED(hRes));
|
|
|
|
#if (_WIN32_IE >= 0x0300)
|
|
INITCOMMONCONTROLSEX iccx;
|
|
iccx.dwSize = sizeof(iccx);
|
|
//iccx.dwICC = ICC_COOL_CLASSES | ICC_BAR_CLASSES;
|
|
iccx.dwICC = 0x3FFF;
|
|
BOOL bRet = ::InitCommonControlsEx(&iccx);
|
|
bRet;
|
|
ATLASSERT(bRet);
|
|
#else
|
|
::InitCommonControls();
|
|
#endif
|
|
|
|
hRes = _Module.Init(NULL, hInstance);
|
|
ATLASSERT(SUCCEEDED(hRes));
|
|
|
|
int nRet = Run(lpstrCmdLine, nCmdShow);
|
|
|
|
_Module.Term();
|
|
::CoUninitialize();
|
|
|
|
return nRet;
|
|
}
|