本文整理汇总了C++中CCrashHandler::SetThreadExceptionHandlers方法的典型用法代码示例。如果您正苦于以下问题:C++ CCrashHandler::SetThreadExceptionHandlers方法的具体用法?C++ CCrashHandler::SetThreadExceptionHandlers怎么用?C++ CCrashHandler::SetThreadExceptionHandlers使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCrashHandler
的用法示例。
在下文中一共展示了CCrashHandler::SetThreadExceptionHandlers方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: crSetErrorMsg
crInstallToCurrentThread2(DWORD dwFlags)
{
crSetErrorMsg(_T("Success."));
CCrashHandler *pCrashHandler =
CCrashHandler::GetCurrentProcessCrashHandler();
if(pCrashHandler==NULL)
{
crSetErrorMsg(_T("Crash handler was already installed for current thread."));
return 1;
}
int nResult = pCrashHandler->SetThreadExceptionHandlers(dwFlags);
if(nResult!=0)
return 2; // Error?
// Ok.
return 0;
}
示例2: crSetErrorMsg
crInstallToCurrentThread2(DWORD dwFlags)
{
crSetErrorMsg(_T("Success."));
CCrashHandler *pCrashHandler =
CCrashHandler::GetCurrentProcessCrashHandler();
if(pCrashHandler==NULL)
{
// AS: Correction of error message
crSetErrorMsg(_T("Crash handler not installed for this process."));
return 1;
}
int nResult = pCrashHandler->SetThreadExceptionHandlers(dwFlags);
if(nResult!=0)
return 2; // Error?
// Ok.
return 0;
}
示例3: InitInstance
BOOL CPeraProcessDesignerApp::InitInstance()
{
ZTools::InitZToolsLog();
if ( !m_CmdLine.Parse() )
{
MessageBox( NULL, "解析命令行失败!", g_lpszAppTitle, MB_OK | MB_TOPMOST );
return FALSE;
}
m_hMetux = CreateMutex(NULL,TRUE,"PeraProcessDesigner.exe");
if (m_hMetux)
{
if (ERROR_ALREADY_EXISTS== GetLastError())
{
HWND hwndPeraProcessDesignerCopied = FindPeraProcessDesignerMainWindow();
//当有互斥,但是没找到窗口时,认为之前的进程还在启动中,简单处理,直接退出
if ( hwndPeraProcessDesignerCopied)
{
if ( !m_CmdLine.GetValue( NULL ).IsEmpty() )
{
#define WS_OPENWS_SENDMSG
#ifdef WS_OPENWS_SENDMSG
DWORD dwProcessId = 0;
GetWindowThreadProcessId(hwndPeraProcessDesignerCopied, &dwProcessId);
if ( GetTopModalWindow( dwProcessId ) == NULL )
{
CSharedMemory Mem;
CString sMemData = g_lpszDoubleOpenWsMemStr;
Mem.Init( g_lpszDoubleOpenWsMemName, sMemData.GetLength()+MAX_PATH );
SendCopyData( hwndPeraProcessDesignerCopied, CPMSG_WORKSPACE_MAKESUREINFO, (LPVOID)NULL, 0 );
sMemData.Empty();
sMemData = (LPCTSTR)Mem.GetData();
if ( sMemData.CompareNoCase( g_lpszDoubleOpenWsMemStr ) == 0 )
{
MessageBox( NULL, "建模环境处于活动状态,请先保存模型后重试!", g_lpszAppTitle, MB_OK | MB_TOPMOST );
}
else
{
CString sCmdLine = ::GetCommandLine();
SendCopyData( hwndPeraProcessDesignerCopied, CPMSG_WORKSPACE_OPENWS, (LPVOID)(LPCTSTR)sCmdLine, sCmdLine.GetLength()+1 );
}
}
else
{
MessageBox( NULL, "建模环境处于活动状态,请先保存模型后重试!", g_lpszAppTitle, MB_OK | MB_TOPMOST );
}
#else
MessageBox( hwndPeraProcessDesignerCopied, "建模环境已打开,请在建模环境中打开本文件!", g_lpszAppTitle, MB_OK | MB_TOPMOST );
#endif
}
if (IsIconic(hwndPeraProcessDesignerCopied))
ShowWindow(hwndPeraProcessDesignerCopied,SW_RESTORE);
SetForegroundWindow(hwndPeraProcessDesignerCopied);
ZTools::WriteZToolsFormatLog("将已经运行的建模窗口激活,并前端显示...");
}
CloseHandle(m_hMetux);
m_hMetux = NULL;
ZTools::WriteZToolsFormatLog("已经存在一个建模客户端,本运行实例将退出...");
return FALSE;
}
}
m_LoginData.m_strRealName = m_CmdLine.GetValue( "realName" );
m_LoginData.m_strUser = m_CmdLine.GetValue( "userName" );
m_LoginData.m_strTicket = m_CmdLine.GetValue( "ticket-proxy" );
WriteShareMemoryLoginInfo();
CCrashHandler ch;
ch.SetProcessExceptionHandlers();
ch.SetThreadExceptionHandlers();
//如果PeraTaskService进程不存在,自动启动
StartPeraTaskService();
//_CrtSetBreakAlloc(1300);
// InitCommonControlsEx() is required on Windows XP if an application
// manifest specifies use of ComCtl32.dll version 6 or later to enable
// visual styles. Otherwise, any window creation will fail.
INITCOMMONCONTROLSEX InitCtrls;
InitCtrls.dwSize = sizeof(InitCtrls);
// Set this to include all the common control classes you want to use
// in your application.
InitCtrls.dwICC = ICC_WIN95_CLASSES;
InitCommonControlsEx(&InitCtrls);
//hModule = ::LoadLibrary("C:\\Users\\kunmiao-li\\Desktop\\TestBuild\\PeraLicMgr\\Release\\PeraLicMgr.dll");
//#ifndef _DEBUG
if (!InitLicense("PeraWorkSpace"))
return FALSE;
// if(!m_FlexNetMgr.CheckOutLicense("PeraWorkSpace"))
// {
// return FALSE;
// }
//.........这里部分代码省略.........
示例4: InitInstance
BOOL CFileManagerApp::InitInstance()
{
// InitCommonControls() is required on Windows XP if an application
// manifest specifies use of ComCtl32.dll version 6 or later to enable
// visual styles. Otherwise, any window creation will fail.
InitCommonControls();
CWinApp::InitInstance();
#if CONSOLE_WND
InitConsoleWindow();
#endif
AfxEnableControlContainer();
LogTools::InitZToolsLog();
CCrashHandler ch;
ch.SetProcessExceptionHandlers();
ch.SetThreadExceptionHandlers();
globalData.SetDPIAware ();
ProcessCmd();
HANDLE hMetux = CreateMutex(NULL,TRUE,"FileManager_Sqlite3");
if (hMetux)
{
if(ERROR_ALREADY_EXISTS==GetLastError())
{
CloseHandle(hMetux);
CWnd * pDeskTopWnd = CWnd::GetDesktopWindow();
CWnd *pFind = pDeskTopWnd->GetWindow(GW_CHILD);
while(pFind)
{
if (::GetProp(pFind->m_hWnd,m_pszExeName))
{
if (::IsIconic(pFind->m_hWnd))
pFind->ShowWindow(SW_RESTORE); // 如果主窗口已经最小话,则恢复其大小
pFind->ShowWindow(SW_SHOW);
pFind->SetForegroundWindow();
::SetForegroundWindow(::GetLastActivePopup(pFind->m_hWnd));
return FALSE; // 前一个运行实例已经存在,退出本实例
}
pFind = pFind->GetWindow(GW_HWNDNEXT);
}
}
}
CFileManagerDlg dlg;
dlg.m_bRunAtBack = m_bRunAtBack;
m_pMainWnd = &dlg;
INT_PTR nResponse = dlg.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
}
BCGCBProCleanUp ();
CloseHandle(hMetux);
// Since the dialog has been closed, return FALSE so that we exit the
// application, rather than start the application's message pump.
return FALSE;
}