本文整理汇总了C++中CAppModule::Init方法的典型用法代码示例。如果您正苦于以下问题:C++ CAppModule::Init方法的具体用法?C++ CAppModule::Init怎么用?C++ CAppModule::Init使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CAppModule
的用法示例。
在下文中一共展示了CAppModule::Init方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: _tWinMain
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));
// this resolves ATL window thunking problem when Microsoft Layer for Unicode (MSLU) is used
::DefWindowProc(NULL, 0, 0, 0L);
AtlInitCommonControls(ICC_COOL_CLASSES | ICC_BAR_CLASSES); // add flags to support other controls
hRes = _Module.Init(NULL, hInstance);
ATLASSERT(SUCCEEDED(hRes));
int nRet = Run(lpstrCmdLine, nCmdShow);
_Module.Term();
::CoUninitialize();
return nRet;
}
示例2: _tWinMain
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));
::PRDataSource *pprdsNew = new ::PRSpoolerDataFile();
tstring file = _T("D:\\SUNNET\\SkyBoard\\Component\\PosterPrinter\\PrintResizer\\prpreview\\objfre_w2k_x86\\i386\\483.tmp");
if (pprdsNew->Open( file )) {
//this->OnNewDataSource(pprdsNew);
} else {
MessageBox(0, L"Fail", 0, 0);
}
// this resolves ATL window thunking problem when Microsoft Layer for Unicode (MSLU) is used
::DefWindowProc(NULL, 0, 0, 0L);
AtlInitCommonControls(ICC_BAR_CLASSES); // add flags to support other controls
hRes = _Module.Init(NULL, hInstance);
ATLASSERT(SUCCEEDED(hRes));
int nRet = 0;
// BLOCK: Run application
{
CMainDlg dlgMain;
nRet = dlgMain.DoModal();
}
_Module.Term();
::CoUninitialize();
return nRet;
}
示例3: wWinMain
int __stdcall wWinMain(HINSTANCE instance,
HINSTANCE,
LPWSTR /*cmdLine*/,
int /*cmdShow*/)
{
{
BOOL isx64;
IsWow64Process(GetCurrentProcess(), &isx64);
onx64 = isx64 == TRUE;
}
try
{
transaction = CreateTransaction(NULL, NULL, NULL, NULL, NULL, NULL, L"Taglib Handler Setup");
if (transaction == INVALID_HANDLE_VALUE)
throw win32_error(L"Couldn't create a transaction");
makeGuard(CloseHandle, transaction);
HRESULT hr;
if (FAILED(hr = _Module.Init(0, instance)))
throw std::exception("Initialisation failed", hr);
makeGuard(&CAppModule::Term, _Module);
InstallDialog dialog;
return dialog.DoModal();
}
catch (std::exception& e)
{
MessageBoxA(msgbox, e.what(), "Fatal error, exiting", MB_ICONERROR | MB_OK);
return -1;
}
catch (win32_error& e)
{
MessageBox(msgbox, e.what().c_str(), L"Unexpected Win32 error, exiting", MB_ICONERROR | MB_OK);
return -2;
}
}
示例4: _tWinMain
int WINAPI _tWinMain(HINSTANCE hInstance, HINSTANCE /*hPrevInstance*/, LPTSTR lpstrCmdLine, int nCmdShow)
{
#ifdef _DEBUG // ATLTRACEで日本語を使うために必要
_tsetlocale(LC_ALL, _T("japanese"));
#endif
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));
// this resolves ATL window thunking problem when Microsoft Layer for Unicode (MSLU) is used
::DefWindowProc(NULL, 0, 0, 0L);
AtlInitCommonControls(ICC_BAR_CLASSES); // add flags to support other controls
hRes = _Module.Init(NULL, hInstance);
ATLASSERT(SUCCEEDED(hRes));
FILE* fp_out = freopen("result.txt", "w", stdout);
g_atomicMegaThreadActive.store(true);
std::thread threadMegaLoop(CMegaAppImpl::StartMegaLoop);
int nRet = Run(lpstrCmdLine, nCmdShow);
g_atomicMegaThreadActive.store(false);
threadMegaLoop.join();
fclose(fp_out);
_Module.Term();
::CoUninitialize();
return nRet;
}
示例5: _tWinMain
int WINAPI _tWinMain(HINSTANCE hInstance, HINSTANCE /*hPrevInstance*/, LPTSTR /*lpstrCmdLine*/, int /*nCmdShow*/)
{
HRESULT hRes = ::OleInitialize(NULL);
ATLASSERT(SUCCEEDED(hRes));
// this resolves ATL window thunking problem when Microsoft Layer for Unicode (MSLU) is used
::DefWindowProc(NULL, 0, 0, 0L);
AtlInitCommonControls(
ICC_WIN95_CLASSES |
ICC_DATE_CLASSES |
ICC_USEREX_CLASSES |
ICC_COOL_CLASSES |
ICC_PAGESCROLLER_CLASS |
ICC_NATIVEFNTCTL_CLASS);
// We use a RichEdit control
HINSTANCE hInstRich = ::LoadLibrary(CRichEditCtrl::GetLibraryName());
ATLASSERT(hInstRich != NULL);
hRes = _Module.Init(NULL, hInstance);
ATLASSERT(SUCCEEDED(hRes));
int nRet = 0;
// BLOCK: Run application
{
CTestWizard wizard;
wizard.ExecuteWizard();
}
::FreeLibrary(hInstRich);
_Module.Term();
::OleUninitialize();
return nRet;
}
示例6: _tWinMain
int WINAPI _tWinMain(HINSTANCE hInstance, HINSTANCE /*hPrevInstance*/, LPTSTR lpstrCmdLine, int nCmdShow) {
HRESULT hRes = ::CoInitialize(NULL);
ATLASSERT(SUCCEEDED(hRes));
// this object must in main/ WinMain
crash_report::CrAutoInstallHelper helper;
if (!InstallCrashReport(helper)) {
return -1;
}
/* Create another thread */
g_CrashThreadInfo.m_bStop = false;
g_CrashThreadInfo.m_hWakeUpEvent = CreateEvent(NULL, FALSE, FALSE, _T("WakeUpEvent"));
ATLASSERT(g_CrashThreadInfo.m_hWakeUpEvent!=NULL);
DWORD dwThreadId = 0;
g_hWorkingThread = CreateThread(NULL, 0, CrashThread, (LPVOID)&g_CrashThreadInfo, 0, &dwThreadId);
ATLASSERT(g_hWorkingThread!=NULL);
// this resolves ATL window thunking problem when Microsoft Layer for Unicode (MSLU) is used
::DefWindowProc(NULL, 0, 0, 0L);
AtlInitCommonControls(ICC_BAR_CLASSES); // add flags to support other controls
hRes = _Module.Init(NULL, hInstance);
ATLASSERT(SUCCEEDED(hRes));
int nRet = Run(lpstrCmdLine, nCmdShow);
_Module.Term();
// Close another thread
g_CrashThreadInfo.m_bStop = true;
SetEvent(g_CrashThreadInfo.m_hWakeUpEvent);
// Wait until thread terminates
WaitForSingleObject(g_hWorkingThread, INFINITE);
::CoUninitialize();
return nRet;
}
示例7: _tWinMain
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));
// this resolves ATL window thunking problem when Microsoft Layer for Unicode (MSLU) is used
::DefWindowProc(NULL, 0, 0, 0L);
HMODULE hInstRichEdit = ::LoadLibrary(_T("Msftedit.dll"));
AtlInitCommonControls(ICC_BAR_CLASSES); // add flags to support other controls
GdiplusStartupInput m_gdiplusStartupInput;
ULONG_PTR m_gdiplusToken;
Status sta = GdiplusStartup(&m_gdiplusToken, &m_gdiplusStartupInput, NULL); //GDI+³õʼ»¯
hRes = _Module.Init(NULL, hInstance);
ATLASSERT(SUCCEEDED(hRes));
int nRet = Run(lpstrCmdLine, nCmdShow);
GdiplusShutdown(m_gdiplusToken);
if( hInstRichEdit != NULL )
{
FreeLibrary( hInstRichEdit );
}
_Module.Term();
::CoUninitialize();
return nRet;
}
示例8: IsDebuggerPresent
int
WINAPI
_tWinMain(HINSTANCE hInstance, HINSTANCE /*hPrevInstance*/, LPTSTR lpstrCmdLine, int nCmdShow)
{
//NdasUiDbgCall( 1, "in, IsDebuggerPresent() = %d\n", IDebugClient2::IsKernelDebuggerEnabled() );
NdasUiDbgCall( 1, "in, IsDebuggerPresent() = %d\n", IsDebuggerPresent() );
OutputDebugString( _T("IsDebuggerPresent()\n") );
// 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);
HRESULT hRes = ::CoInitialize(NULL);
ATLASSERT(SUCCEEDED(hRes));
// this resolves ATL window thunking problem when Microsoft Layer for Unicode (MSLU) is used
::DefWindowProc( NULL, 0, 0, 0L );
::AtlInitCommonControls( ICC_COOL_CLASSES | ICC_BAR_CLASSES );
// add flags to support other controls
hRes = _Module.Init(NULL, hInstance);
ATLASSERT(SUCCEEDED(hRes));
int ret = Run( lpstrCmdLine, nCmdShow );
_Module.Term();
::CoUninitialize();
NdasUiDbgCall( 1, "*********out**********\n" );
return ret;
}
示例9: LoadLuaRunTime
extern "C" __declspec(dllexport) void LoadLuaRunTime(char* szInstallDir,char* szParam)
{
TSTRACEAUTO();
HRESULT hr = ::CoInitialize(NULL);
hr = _Module.Init(NULL, gInstance);
CMessageLoop theLoop;
_Module.AddMessageLoop(&theLoop);
CLRTAgent lrtAgent;
if (lrtAgent.InitLua(szInstallDir,szParam))
{
TSDEBUG4CXX(_T(">>>>>theLoop.Run()"));
theLoop.Run();
TSDEBUG4CXX(_T("<<<<<theLoop.Run()"));
}
_Module.RemoveMessageLoop();
_Module.Term();
::CoUninitialize();
TerminateProcess(::GetCurrentProcess(), S_OK);
return;
}
示例10: InitializeGui
int InitializeGui(HINSTANCE hInstance, LPARAM param)
{
CoInitialize(NULL);
AtlInitCommonControls(ICC_LISTVIEW_CLASSES | ICC_TREEVIEW_CLASSES);
Scylla::initAsGuiApp();
IsDllMode = false;
HRESULT hRes = _Module.Init(NULL, hInstance);
ATLASSERT(SUCCEEDED(hRes));
int nRet = 0;
// BLOCK: Run application
{
MainGui dlgMain;
pMainGui = &dlgMain; // o_O
CMessageLoop loop;
_Module.AddMessageLoop(&loop);
dlgMain.Create(GetDesktopWindow(), param);
dlgMain.ShowWindow(SW_SHOW);
loop.Run();
}
_Module.Term();
CoUninitialize();
return nRet;
}
示例11: DllMain
BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID /*lpReserved*/)
{
if (dwReason == DLL_PROCESS_ATTACH) {
_Module.Init(ObjectMap, hInstance);
DisableThreadLibraryCalls(hInstance);
CRegKey regCfg;
DWORD dwSize = _MAX_PATH;
if (ERROR_SUCCESS != regCfg.Open(HKEY_CURRENT_USER, _T("Software"), KEY_READ) ||
ERROR_SUCCESS != regCfg.Open(regCfg, REG_COMPANY_KEY, KEY_READ) ||
ERROR_SUCCESS != regCfg.Open(regCfg, REG_PRODUCT_KEY, KEY_READ) ||
ERROR_SUCCESS != regCfg.Open(regCfg, _T("Config"), KEY_READ) ||
ERROR_SUCCESS != regCfg.QueryValue(g_cbTRiAS, _T("TRiASName"), &dwSize) ||
0 == dwSize)
{
strcpy (g_cbTRiAS, g_cbTRiASDefaultName); // default
}
}
else if (dwReason == DLL_PROCESS_DETACH) {
_Module.Term();
}
return TRUE; // ok
}
示例12: _tWinMain
int WINAPI _tWinMain(HINSTANCE hInstance, HINSTANCE /*hPrevInstance*/, LPTSTR lpstrCmdLine, int /*nCmdShow*/)
{
int argc = 0;
LPWSTR* argv = CommandLineToArgvW(lpstrCmdLine, &argc);
int nDelFlagPos = CmdLineFindFlag(argc, argv, L"-d");
if (nDelFlagPos >= 0 && argc >= nDelFlagPos + 3)
{
DeleteUninst(argv[nDelFlagPos + 1], argv[nDelFlagPos + 2]);
return 0;
}
//保证程序是唯一实例
UniqueApp unique_uninst;
if(!unique_uninst.Register())
{
//窗口激活,前置
// activate an application with a window with a specific class name
HWND pWndPrev, pWndChild;
// Determine if a window with the class name exists...
pWndPrev = FindWindow(_T("#32770"), UNINSTALL_TITLE);
if(NULL != pWndPrev)
{
// If so, does it have any popups?
pWndChild = GetLastActivePopup(pWndPrev);
// If iconic, restore the main window
if(IsIconic(pWndPrev))
ShowWindow(pWndPrev,SW_RESTORE);
// Bring the main window or its popup to the foreground
SetForegroundWindow(pWndChild);
// and you are done activating the other application
return EXIT_ERROR_NOT_GET_OTHER_INSTANCE_WND;
}
return EXIT_ERROR_GET_OTHER_INSTANCE_WND;
}
InitDataReport(argc, argv);
HRESULT hRes = ::CoInitialize(NULL);
GDIPlusFacade::Startup(hInstance);
// 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));
// this resolves ATL window thunking problem when Microsoft Layer for Unicode (MSLU) is used
::DefWindowProc(NULL, 0, 0, 0L);
AtlInitCommonControls(ICC_BAR_CLASSES); // add flags to support other controls
hRes = _Module.Init(NULL, hInstance);
ATLASSERT(SUCCEEDED(hRes));
int nRet = 0;
{
if (!CUnInstallManager::GetInstance().Init()) //安装前置条件
goto EXIT_MAIN;
}
// BLOCK: Run application
{
CChooseUninstallDialog dlg_choose_uninstall;
nRet = dlg_choose_uninstall.DoModal();
}
CUnInstallManager::GetInstance().UnInit();
EXIT_MAIN:
_Module.Term();
GDIPlusFacade::Shutdown();
::CoUninitialize();
ygdata_report::Exit(TRUE);
if (argv)
{
LocalFree(argv);
argv = NULL;
}
return nRet;
}
示例13: _tWinMain
int WINAPI _tWinMain(HINSTANCE hInstance, HINSTANCE /*hPrevInstance*/, LPTSTR lpstrCmdLine, int nCmdShow)
{
CRecordProgram::GetInstance()->RecordCommonInfo(MY_PRO_NAME, MY_THREAD_ID_INIT, L"启动");
DWORD pid = ::GetCurrentThreadId();
HRESULT hRes = ::CoInitialize(NULL);
g_strSkinDir = ::GetModulePath();
g_strSkinDir += _T("\\Skin\\");
// 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);
if (_tcsncmp(lpstrCmdLine, _T("-reblack"), 8) == 0)
{
HANDLE hEvent = OpenEventW(EVENT_ALL_ACCESS, FALSE, L"MONEYHUBEVENT_BLACKUPDATE");
CRecordProgram::GetInstance()->RecordCommonInfo(MY_PRO_NAME, MY_THREAD_ID_INIT, L"重新创建黑名单");
CGlobalData::GetInstance()->Init();
int iReturn = (int)_SecuCheckPop.CheckBlackListCache();
if( hEvent )
{
SetEvent(hEvent);
CloseHandle(hEvent);
}
return iReturn;
}
if (_tcsncmp(lpstrCmdLine, _T("-rebuild"), 8) == 0)
{
HANDLE hEvent = OpenEventW(EVENT_ALL_ACCESS, FALSE, L"MONEYHUBEVENT_WHITEUPDATE");
CRecordProgram::GetInstance()->RecordCommonInfo(MY_PRO_NAME, MY_THREAD_ID_INIT, L"重新创建白名单");
CGlobalData::GetInstance()->Init();
int iReturn = (int)_SecuCheckPop.ReBuildSercurityCache();
if( hEvent )
{
SetEvent(hEvent);
CloseHandle(hEvent);
}
return iReturn;
}
ThreadCacheDC::InitializeThreadCacheDC();
ThreadCacheDC::CreateThreadCacheDC();
DWORD dw;
CloseHandle(CreateThread(NULL, 0, _threadTestDownloadMode, NULL, 0, &dw));
Gdiplus::GdiplusStartupInput gdiplusStartupInput;
ULONG_PTR gdiplusToken;
Gdiplus::GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL);
if(CGlobalData::GetInstance()->IsPopAlreadyRunning() == TRUE)
{
mhMessageBox(NULL, _T("泡泡程序已经在运行中..."), L"财金汇", MB_OK | MB_SETFOREGROUND);
return 0;
}
ATLASSERT(SUCCEEDED(hRes));
CUserBehavior::GetInstance()->BeginFeedBack();
_SecuCheckPop.Start();// 开启安全检测及驱动进程
CRecordProgram::GetInstance()->RecordCommonInfo(MY_PRO_NAME, MY_THREAD_ID_INIT, L"启动安全检测及驱动进程");
//CUSBControl::GetInstance()->BeginUSBControl();
// this resolves ATL window thunking problem when Microsoft Layer for Unicode (MSLU) is used
::DefWindowProc(NULL, 0, 0, 0L);
AtlInitCommonControls(ICC_WIN95_CLASSES | ICC_PROGRESS_CLASS | ICC_BAR_CLASSES); // add flags to support other controls
hRes = _Module.Init(NULL, hInstance);
ATLASSERT(SUCCEEDED(hRes));
CRecordProgram::GetInstance()->RecordCommonInfo(MY_PRO_NAME, MY_THREAD_ID_INIT, L"运行");
int nRet = Run(lpstrCmdLine, nCmdShow);
_Module.Term();
//::CoUninitialize();
CUserBehavior::GetInstance()->CloseFeedBack();
return nRet;
}
示例14: wWinMain
int APIENTRY wWinMain(_In_ HINSTANCE hInstance,
_In_opt_ HINSTANCE hPrevInstance,
_In_ LPWSTR lpCmdLine,
_In_ int nCmdShow)
{
// Attempt to mitigate http://textslashplain.com/2015/12/18/dll-hijacking-just-wont-die
HMODULE hKernel32 = LoadLibrary(L"kernel32.dll");
ATLASSERT(hKernel32 != NULL);
SetDefaultDllDirectoriesFunction pfn = (SetDefaultDllDirectoriesFunction) GetProcAddress(hKernel32, "SetDefaultDllDirectories");
if (pfn) { (*pfn)(LOAD_LIBRARY_SEARCH_SYSTEM32); }
int exitCode = -1;
CString cmdLine(lpCmdLine);
if (cmdLine.Find(L"--checkInstall") >= 0) {
// If we're already installed, exit as fast as possible
if (!MachineInstaller::ShouldSilentInstall()) {
exitCode = 0;
goto out;
}
// Make sure update.exe gets silent
wcscat(lpCmdLine, L" --silent");
}
HRESULT hr = ::CoInitialize(NULL);
ATLASSERT(SUCCEEDED(hr));
AtlInitCommonControls(ICC_COOL_CLASSES | ICC_BAR_CLASSES);
hr = _Module.Init(NULL, hInstance);
bool isQuiet = (cmdLine.Find(L"-s") >= 0);
bool weAreUACElevated = CUpdateRunner::AreWeUACElevated() == S_OK;
bool attemptingToRerun = (cmdLine.Find(L"--rerunningWithoutUAC") >= 0);
if (weAreUACElevated && attemptingToRerun) {
CUpdateRunner::DisplayErrorMessage(CString(L"Please re-run this installer as a normal user instead of \"Run as Administrator\"."), NULL);
exitCode = E_FAIL;
goto out;
}
if (!CFxHelper::CanInstallDotNet4_5()) {
// Explain this as nicely as possible and give up.
MessageBox(0L, L"This program cannot run on Windows XP or before; it requires a later version of Windows.", L"Incompatible Operating System", 0);
exitCode = E_FAIL;
goto out;
}
if (!CFxHelper::IsDotNet45OrHigherInstalled()) {
hr = CFxHelper::InstallDotNetFramework(isQuiet);
if (FAILED(hr)) {
exitCode = hr; // #yolo
CUpdateRunner::DisplayErrorMessage(CString(L"Failed to install the .NET Framework, try installing .NET 4.5 or higher manually"), NULL);
goto out;
}
// S_FALSE isn't failure, but we still shouldn't try to install
if (hr != S_OK) {
exitCode = 0;
goto out;
}
}
// If we're UAC-elevated, we shouldn't be because it will give us permissions
// problems later. Just silently rerun ourselves.
if (weAreUACElevated) {
wchar_t buf[4096];
HMODULE hMod = GetModuleHandle(NULL);
GetModuleFileNameW(hMod, buf, 4096);
wcscat(lpCmdLine, L" --rerunningWithoutUAC");
CUpdateRunner::ShellExecuteFromExplorer(buf, lpCmdLine);
exitCode = 0;
goto out;
}
exitCode = CUpdateRunner::ExtractUpdaterAndRun(lpCmdLine, false);
out:
_Module.Term();
::CoUninitialize();
return exitCode;
}
示例15: _tWinMain
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));
// Install crash reporting
#ifdef TEST_DEPRECATED_FUNCS
g_pCrashRptState = Install(
CrashCallback,
_T("[email protected]"),
_T("Crash"));
#else
CR_INSTALL_INFO info;
memset(&info, 0, sizeof(CR_INSTALL_INFO));
info.cb = sizeof(CR_INSTALL_INFO);
info.pszAppName = _T("CrashRpt Tests");
info.pszAppVersion = _T("1.2.2");
info.pszEmailSubject = _T("Error from CrashRptTests");
info.pszEmailTo = _T("[email protected]");
info.pszUrl = _T("http://myappcom.com/crashrpt.php");
info.pfnCrashCallback = CrashCallback; // Define crash callback function
// Define sending priorities
info.uPriorities[CR_HTTP] = 3; // Use HTTP the first
info.uPriorities[CR_SMTP] = 2; // Use SMTP the second
info.uPriorities[CR_SMAPI] = 1; // Use Simple MAPI the last
info.dwFlags = 0;
info.dwFlags |= CR_INST_ALL_EXCEPTION_HANDLERS; // Install all available exception handlers
info.dwFlags |= CR_INST_HTTP_BINARY_ENCODING; // Use binary encoding for HTTP uploads (recommended).
info.pszDebugHelpDLL = NULL; // Search for dbghelp.dll using default search sequence
info.uMiniDumpType = MiniDumpNormal; // Define minidump size
info.pszPrivacyPolicyURL = _T("http://code.google.com/p/crashrpt/wiki/PrivacyPolicyTemplate");
info.pszErrorReportSaveDir = NULL; // Save error reports to the default location
CrAutoInstallHelper cr_install_helper(&info);
ATLASSERT(cr_install_helper.m_nInstallStatus==0);
if(cr_install_helper.m_nInstallStatus!=0)
{
TCHAR buff[256];
crGetLastErrorMsg(buff, 256);
MessageBox(NULL, buff, _T("crInstall error"), MB_OK);
return FALSE;
}
#endif //TEST_DEPRECATED_FUNCS
/* Create another thread */
g_CrashThreadInfo.m_pCrashRptState = g_pCrashRptState;
g_CrashThreadInfo.m_bStop = false;
g_CrashThreadInfo.m_hWakeUpEvent = CreateEvent(NULL, FALSE, FALSE, _T("WakeUpEvent"));
ATLASSERT(g_CrashThreadInfo.m_hWakeUpEvent!=NULL);
DWORD dwThreadId = 0;
g_hWorkingThread = CreateThread(NULL, 0, CrashThread, (LPVOID)&g_CrashThreadInfo, 0, &dwThreadId);
ATLASSERT(g_hWorkingThread!=NULL);
// this resolves ATL window thunking problem when Microsoft Layer for Unicode (MSLU) is used
::DefWindowProc(NULL, 0, 0, 0L);
AtlInitCommonControls(ICC_BAR_CLASSES); // add flags to support other controls
hRes = _Module.Init(NULL, hInstance);
ATLASSERT(SUCCEEDED(hRes));
int nRet = Run(lpstrCmdLine, nCmdShow);
_Module.Term();
// Close another thread
g_CrashThreadInfo.m_bStop = true;
SetEvent(g_CrashThreadInfo.m_hWakeUpEvent);
// Wait until thread terminates
WaitForSingleObject(g_hWorkingThread, INFINITE);
#ifdef TEST_DEPRECATED_FUNCS
// Uninstall crash reporting
Uninstall(g_pCrashRptState);
#endif //TEST_DEPRECATED_FUNCS
::CoUninitialize();
return nRet;
}