I THINK I'M ALMOST THERE!
Here's what I have so far:
Code:
LRESULT CALLBACK WindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
HBITMAP ball;
HDC hdc = NULL;
HDC compat_hdc;
PAINTSTRUCT ps;
RECT rc;
switch (message)
{
case WM_CREATE:
UpdateWindow(hwnd);
if( ball = (HBITMAP) LoadImage(hin, "ball.bmp", IMAGE_BITMAP, rc.right, rc.bottom, LR_LOADFROMFILE) == 0)
{
MessageBox(hwnd, "Load of resources failed.", "Error",
MB_OK | MB_ICONEXCLAMATION);
}
if(GetClientRect(hwnd, &rc) == 0)
{
MessageBox(hwnd, "GetClientrect failed.", "Error",
MB_OK | MB_ICONEXCLAMATION);
}
if( (compat_hdc = CreateCompatibleDC(hdc)) == NULL)
{
MessageBox(hwnd, "CreateCompatibleDC failed.", "Error",
MB_OK | MB_ICONEXCLAMATION);
}
if(SelectObject(chdc,ball) == 0)
{
MessageBox(hwnd, "Selection failed.", "Error",
MB_OK | MB_ICONEXCLAMATION);
}
if(BitBlt(hdc,0,0,10,10,chdc,0,0,SRCCOPY) == 0)
{
MessageBox(hwnd, "Blit failed.", "Error",
MB_OK | MB_ICONEXCLAMATION);
}
DeleteObject(ball);
DeleteDC(chdc);
Now the failure is only during the BitBlt() operation! Any Ideas?