Studying your code and fixing it seemed
like too much so I'm giving you this piece
of code that you simply graft in the switch-
case sequence of your windproc
case WM_PAINT:
{
HDC dc = GetDC(hWnd);
HDC memDC ;
HBITMAP memBitmap = LoadBitmap(hInstance,MAKEINTRESOURCE(IDB_BITMAP_ON E));
HBITMAP oldBitmap ;
memDC = CreateCompatibleDC(dc) ;
oldBitmap = (HBITMAP)SelectObject(memDC,memBitmap) ;
BITMAP bm;
GetObject(memBitmap, sizeof(BITMAP), (LPVOID)&bm);
if (memDC != NULL)
{
StretchBlt(dc,0, 0, m_nClientWidth, m_nClientHeight, memDC, 0, 0, bm.bmWidth, bm.bmHeight, SRCCOPY) ;
}
SelectObject(memDC,oldBitmap) ;
}
break;
you need to provide this code with the
size of the window, put this code
somewhere under before this code after the.
RECT rect;
GetClientRect(hWnd,&rect);
m_nClientWidth = rect.right-rect.left;
m_nClientHeight = rect.bottom - rect.top;
Also the code assummes that you have a bitmap with name IDB_BITMAP_ONE to be drawn.
|