M
codeBlocks schrieb:
öhm, ich weiß nicht wie ich den error aussgeben soll
void ErrorDescription(LPTSTR lpszFunction)
{
LPVOID lpMsgBuf;
LPVOID lpDisplayBuf;
DWORD dw = GetLastError();
FormatMessage(
FORMAT_MESSAGE_ALLOCATE_BUFFER |
FORMAT_MESSAGE_FROM_SYSTEM,
NULL,
dw,
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
(LPTSTR)&lpMsgBuf,
0,
NULL);
lpDisplayBuf = (LPVOID)LocalAlloc(
LMEM_ZEROINIT,
(lstrlen((LPCTSTR)lpMsgBuf) + lstrlen((LPCTSTR)lpszFunction) + 40) * sizeof(TCHAR));
wsprintf(
(LPTSTR)lpDisplayBuf,
TEXT("%s failed with error %d: %s"),
lpszFunction, dw, lpMsgBuf);
MessageBox(NULL, (LPCTSTR)lpDisplayBuf, TEXT("Error"), MB_OK);
LocalFree(lpMsgBuf);
LocalFree(lpDisplayBuf);
}
// ...
hBG = (HBITMAP)LoadImage(0,MAKEINTRESOURCE(BITMAP_0),IMAGE_BITMAP, 0, 0,LR_DEFAULTSIZE|LR_LOADFROMFILE|LR_CREATEDIBSECTION);
if (!hBG)
{
ErrorDescription("LoadImage");
[edit] tags