A Small Help

Discussion in 'Win32' started by alok, Jul 27, 2004.

  1. alok

    alok New Member

    Joined:
    Jul 24, 2004
    Messages:
    127
    Likes Received:
    2
    Trophy Points:
    0
    Occupation:
    S/W Engg
    Home Page:
    http://www.thatsalok.com
    this is samll code for dynamically loading the Bitmap Resource in Vc++ Program

    hdc = BeginPaint(hWnd, &ps);hdc = GetDC(hWnd); // remove this statementhbitmap = (HBITMAP)LoadImage(NULL,szFileName,IMAGE_BITMAP,0,0,LR_DEFAULTSIZE|LR_LOADFROMFILE);if(hbitmap==NULL){ // add thisMessageBox(hWnd,"coudnt load ", "error ", MB_OK);break; // replace it with return statement} // add this// this doesnt return NULL , so the image is getting loaded properly ????HDC hdcMem = CreateCompatibleDC(hdc); GetObject(hbitmap ,sizeof(bmp), &bmp);SelectObject(hdcMem, hbitmap); BitBlt(hdc, 0, 0, bmp.bmWidth, bmp.bmHeight, hdcMem, 0, 0, SRCCOPY); DeleteDC(hdcMem);EndPaint(hWnd, &ps);
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice