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


Bitblt problem

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