HRESULT dhShowException(PDH_EXCEPTION pException) { WCHAR szMessage[512]; dhFormatExceptionW(pException, szMessage, ARRAYSIZE(szMessage), FALSE); MessageBoxW(g_ExceptionOptions.hwnd, szMessage, g_ExceptionOptions.szAppName, MB_ICONSTOP | MB_SETFOREGROUND); return NOERROR; }
HRESULT dhFormatExceptionA(PDH_EXCEPTION pException, LPSTR szBuffer, UINT cchBufferSize, BOOL bFixedFont) { WCHAR szBufferW[1024]; dhFormatExceptionW(pException, szBufferW, ARRAYSIZE(szBufferW), bFixedFont); if (0 == WideCharToMultiByte(CP_ACP, 0, szBufferW, -1, szBuffer, cchBufferSize, NULL, NULL)) return HRESULT_FROM_WIN32( GetLastError() ); return NOERROR; }
/* ************************************************************************** * dhShowException: * This function calls dhFormatException to format the provided exception * into a string and then shows it in a MessageBox. * ============================================================================ */ HRESULT dhShowException(PDH_EXCEPTION pException) { WCHAR szMessage[512]; dhFormatExceptionW(pException, szMessage, ARRAYSIZE(szMessage), FALSE); /* NOTE: MessageBoxW is one of the few unicode APIs available on Win9x. */ MessageBoxW(g_ExceptionOptions.hwnd, szMessage, g_ExceptionOptions.szAppName, MB_ICONSTOP | MB_SETFOREGROUND); return NOERROR; }