I am trying to make a Yahtzee game and I have 6 bitmaps representing the 6 possible rolls. The trouble is the code I am using, which seems correct at first glance and compiles but is not showing the bit map in my dialog.
Code:
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include "resource.h"
HINSTANCE hInst;
BOOL CALLBACK DialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
HDC hDC, MemDCFull;
PAINTSTRUCT Ps;
HBITMAP bmpFull;
switch(uMsg)
{
case WM_INITDIALOG:
{
return TRUE;
}
case WM_PAINT:
{
hDC = BeginPaint(hwndDlg, &Ps);
bmpFull = LoadBitmap(hInst, MAKEINTRESOURCE(IDB_BITMAP1));
MemDCFull = CreateCompatibleDC(hDC);
SelectObject(MemDCFull, bmpFull);
BitBlt(hDC, 50, 50, 32, 32, MemDCFull, 32, 32, SRCCOPY);
DeleteDC(MemDCFull);
DeleteObject(bmpFull);
EndPaint(hwndDlg, &Ps);
return TRUE;
}
}
return FALSE;
}
int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd)
{
hInst = hInstance;
return DialogBox(hInstance, MAKEINTRESOURCE(DLG_MAIN), NULL, (DLGPROC)DialogProc);
}
Any tips are appreciated.
edit: the bitmaps are only 32x32 - is that too small?