View Single Post
  #2 (permalink)  
Old September 3rd, 2003, 04:26 AM
Ankur_Verma Ankur_Verma is offline
Friend of Wrox
 
Join Date: Jun 2003
Posts: 453
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via AIM to Ankur_Verma Send a message via MSN to Ankur_Verma
Default

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.
Reply With Quote