Hi all,
I'd like to add a background to the main window of my win32 app.
I'm using resedit to manage resources, and I've already added a bitmap and set it to the main window.
Now I'm having issues to display it, here is the bitmap in my resource file (generated by resedit):
CONTROL IDB_BG, 0, WC_STATIC, SS_BITMAP, 0, 0, 517, 252, WS_EX_LEFT
Here is how I'm trying to display the bitmap:
case WM_INITDIALOG:
bg = (HBITMAP) LoadBitmap(GetModuleHandle(NULL), MAKEINTRESOURCE(IDB_BG));
break;
case WM_PAINT:
PAINTSTRUCT ps;
HDC hdc;
BITMAP bitmap;
HDC hdcMem;
HGDIOBJ oldBitmap;
hdc = BeginPaint(hwndDlg, &ps);
hdcMem = CreateCompatibleDC(hdc);
oldBitmap = SelectObject(hdcMem, bg);
GetObject(bg, sizeof(bitmap), &bitmap);
BitBlt(hdc, 0, 0, bitmap.bmWidth, bitmap.bmHeight, hdcMem, 0, 0, SRCCOPY);
SelectObject(hdcMem, oldBitmap);
DeleteDC(hdcMem);
EndPaint(hwndDlg, &ps);
break;
The program compiles but the bitmap isn't displayed.
Thanks for the help!