CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Oct 2010
    Location
    Australia
    Posts
    98

    [RESOLVED] Resource Defined BitMap Not Working or Showing

    I am trying to make a Yahtzee game and I have 6 bitmaps representing the 6 possible rolls. The trouble is the code I am using, which seems correct at first glance and compiles but is not showing the bit map in my dialog.

    Code:
    #define WIN32_LEAN_AND_MEAN
    #include <windows.h>
    #include "resource.h"
    
    HINSTANCE hInst;
    
    BOOL CALLBACK DialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
    {
        HDC hDC, MemDCFull;
        PAINTSTRUCT Ps;
        HBITMAP bmpFull;
    
        switch(uMsg)
        {
            case WM_INITDIALOG:
            {
    
                return TRUE;
            }
            case WM_PAINT:
            {
                hDC = BeginPaint(hwndDlg, &Ps);
    
                bmpFull = LoadBitmap(hInst, MAKEINTRESOURCE(IDB_BITMAP1));
    
                MemDCFull = CreateCompatibleDC(hDC);
    
                SelectObject(MemDCFull, bmpFull);
    
                BitBlt(hDC, 50, 50, 32, 32, MemDCFull, 32, 32, SRCCOPY);
    
                DeleteDC(MemDCFull);
                DeleteObject(bmpFull);
                EndPaint(hwndDlg, &Ps);
    
                return TRUE;
            }
    
        }
        return FALSE;
    }
    
    int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd)
    {
        hInst = hInstance;
    
        return DialogBox(hInstance, MAKEINTRESOURCE(DLG_MAIN), NULL, (DLGPROC)DialogProc);
    }
    Any tips are appreciated.

    edit: the bitmaps are only 32x32 - is that too small?
    Last edited by Morbane; November 19th, 2010 at 04:42 AM.

  2. #2
    Join Date
    Oct 2010
    Location
    Australia
    Posts
    98

    Re: Resource Defined BitMap Not Working or Showing

    Apparently My bitmaps were corrupt!!!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured