This topic is now archived and is closed to further replies.

Bitblt problem

This topic is 5376 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, I'm having problems with an image blit. The picture is loaded well, but it is only displayed in 16 colors instead of 24bit colors. These are parts of the code: defined variables:
  HBITMAP hbmLogo;
BITMAP bm;  
window callback:
    case WM_CREATE:
        hbmLogo = (HBITMAP)LoadImage(0, "Data\\textures\\system\\logo.bmp", IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE);
            MessageBox(hwnd, "Loading of image failed.", "Error", MB_OK | MB_ICONEXCLAMATION);
            return -1;
        GetObject(hbmLogo, sizeof(bm), &bm);
    case WM_PAINT:
            PAINTSTRUCT ps;
            HDC hdcWindow;
            hdcWindow = BeginPaint(hwnd, &ps);
            // draw logo

               HDC hdcMemory;
               hdcMemory = CreateCompatibleDC(hdcWindow);
               SelectObject(hdcMemory, hbmLogo);
               BitBlt(hdcWindow, 0, 0, bm.bmWidth, bm.bmHeight, hdcMemory, 0, 0, SRCPAINT);
            EndPaint(hwnd, &ps);
[edited by - Vich on April 30, 2003 7:50:31 AM]

Share this post

Link to post
Share on other sites
I removed the blitting code and solved the problem by doing this:
It whas worth the full hour of searching on :|

     logobackground.lbStyle = BS_PATTERN;
logobackground.lbHatch = (long)LoadImage(hInstance,"Data\\textures\\system\\loadlogo.bmp", IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE);
LoadWndClass.hbrBackground = CreateBrushIndirect(&logobackground);

Share this post

Link to post
Share on other sites