mirror of
https://github.com/reactos/reactos.git
synced 2024-10-21 00:18:26 +00:00
406dfdbc87
Sync trunk (rr49606) svn path=/branches/cmake-bringup/; revision=49607
15 lines
535 B
C
15 lines
535 B
C
#include <regedit.h>
|
|
void ErrorMessageBox(HWND hWnd, LPCTSTR title, DWORD code)
|
|
{
|
|
LPTSTR lpMsgBuf;
|
|
DWORD status;
|
|
static const TCHAR fallback[] = TEXT("Error displaying error message.\n");
|
|
status = FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
|
|
NULL, code, 0, (LPTSTR)&lpMsgBuf, 0, NULL);
|
|
if (!status)
|
|
lpMsgBuf = (LPTSTR)fallback;
|
|
MessageBox(hWnd, lpMsgBuf, title, MB_OK | MB_ICONERROR);
|
|
if (lpMsgBuf != fallback)
|
|
LocalFree(lpMsgBuf);
|
|
}
|