I can't load the bitmap from my resource script...When i replace the path in the LoadImage() function with MAKEINTRESOURCE(), the image don't load..
Code:
hBmp = (HBITMAP)LoadImage(*pInst, MAKEINTRESOURCE(IMG_SPLASH), IMAGE_BITMAP, 0, 0, LR_DEFAULTSIZE)
Calling Getlasterror returns 1814, but the image is in the resource script.. Any suggestions to what's wrong??
The code below works, but it means i have to load the image from a file...
Code:
BOOL CALLBACK DialogProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam){
static HBRUSH hBrLg;//Dark gray/Light gray brush
static HBITMAP hBmp;
HDC hDC, hDcMem;
PAINTSTRUCT ps;
switch(uMsg){
case WM_INITDIALOG:
hwThis=hWnd;
hBrLg = CreateSolidBrush(GetSysColor(COLOR_MENU));
hBmp = (HBITMAP)LoadImage(0, "C:\\_Src\\CPP\\Setup.bmp", IMAGE_BITMAP, 0, 0, LR_DEFAULTSIZE|LR_LOADFROMFILE);
ShowWindow(hwThis, SW_SHOW);
break;
case WM_LBUTTONDOWN:
EndDialog(hwThis, 0); break;
case WM_COMMAND:
switch(LOWORD(wParam)){
case IDCANCEL:
case IDOK:
EndDialog(hwThis, 0);
break;
}
break;
case WM_PAINT:
ZeroMemory(&ps, sizeof(PAINTSTRUCT));
BeginPaint(hwThis, &ps);
hDC = GetDC(hwThis);
hDcMem = CreateCompatibleDC(hDC);
SelectObject(hDcMem, hBmp);
BitBlt(hDC, 5, 5, 300, 200, hDcMem, 0, 0, SRCCOPY);
DeleteDC(hDcMem);
EndPaint(hwThis, &ps);
break;
case WM_CTLCOLORSTATIC:
SetTextColor((HDC)wParam, 0x880000);
SetBkColor((HDC)wParam, GetSysColor(COLOR_MENU));
return((int)hBrLg);
case WM_DESTROY:
DeleteObject(hBrLg);
DeleteObject(hBmp);
break;
}
return(0);
}