Cant get an image to show on my HDC
I cant seem to get a BITMAP to show on my HDC
//globals
Code:
//Win32 Bitmap stuff
HANDLE hImage;
HWND button_hWnd;
HDC hdc;
HDC c_hdc;
BITMAP Bitmap;
SIZE ImageSize;
Code:
hImage = LoadImage(hInstance,"Test.bmp",IMAGE_BITMAP,0,0,LR_LOADFROMFILE);
if(hImage != INVALID_HANDLE_VALUE)
{
MessageBox(NULL,"Loaded Test.bmp","",0);
}
hdc = GetDC(hWnd);
c_hdc = CreateCompatibleDC(hdc);
GetObject(c_hdc,sizeof(BITMAP),&Bitmap);
ImageSize.cx = Bitmap.bmWidth;
ImageSize.cy = Bitmap.bmHeight;
in the Wndproc WM_PAINT message
Code:
case WM_PAINT:
hdc = BeginPaint(hWnd, &ps);
SelectObject(c_hdc,hImage);
BitBlt(hdc,0,0,ImageSize.cx,ImageSize.cy,c_hdc,0,0,SRCCOPY);
// TODO: Add any drawing code here...
EndPaint(hWnd, &ps);
break;