2 void ErrorMessageBox(HWND hWnd
, LPCTSTR title
, DWORD code
)
6 static const TCHAR fallback
[] = TEXT("Error displaying error message.\n");
7 status
= FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER
| FORMAT_MESSAGE_FROM_SYSTEM
,
8 NULL
, code
, 0, (LPTSTR
)&lpMsgBuf
, 0, NULL
);
10 lpMsgBuf
= (LPTSTR
)fallback
;
11 MessageBox(hWnd
, lpMsgBuf
, title
, MB_OK
| MB_ICONERROR
);
12 if (lpMsgBuf
!= fallback
)