Bitmap Display Probelm

This is a discussion on Bitmap Display Probelm within the Windows Programming forums, part of the Platform Specific Boards category; I have to build a project. For that I am using an OWNER Drwan Menu. Now i want the small ...

  1. #1
    Registered User
    Join Date
    May 2005
    Posts
    15

    Bitmap Display Probelm

    I have to build a project. For that I am using an

    OWNER Drwan Menu. Now i want the small part of the

    remaining space to have an image. i.e a small logo

    in the top right corner of the application on the

    menu bar unused space. Now to dry that I just typed

    a code to display an image somewahere in the main

    window. But the output is not showing the Bitmap.

    Why is that.

    I have also uploaded the project itself :

    http://www.geocities.com/kalamirch/menu_two.zip

  2. #2
    Registered User kryptkat's Avatar
    Join Date
    Dec 2002
    Posts
    638
    made many changes. got it working. you need to look up wm_paint.

    i moved bitmap to see if it display. put back where you want.

    let see if .zip attaches.

    edit will not allow zip "invalid file type"


    Code:
    under case wm-creat at end
    
    
       // Load the bitmap from the resource
    			        bmpExercising = LoadBitmap(GetModuleHandle(NULL), MAKEINTRESOURCE(IDB_EXERCISING));
    
    
    under wm-paint
    
    
                                   BITMAP bm;                               
    
                                   PAINTSTRUCT ps;
    
    
    
    				HDC hdc = BeginPaint(hwnd, &ps);
    
    				// Load the bitmap from the resource
    			      //  bmpExercising = LoadBitmap(hInstance, MAKEINTRESOURCE(IDB_EXERCISING));
    				// Create a memory device compatible with the above DC variable
    				HDC MemDCExercising = CreateCompatibleDC(hdc);
    					 // Select the new bitmap
    				HBITMAP hbmOld = SelectObject(MemDCExercising, bmpExercising);
    
                                    GetObject(bmpExercising, sizeof(bm), &bm);
    
    				// Copy the bits from the memory DC into the current dc
    				BitBlt(hdc, 20, 20, bm.bmWidth, bm.bmHeight, MemDCExercising, 0, 0, SRCCOPY);
    
    				// Restore the old bitmap
                                    SelectObject(MemDCExercising, hbmOld);
    
    				DeleteDC(MemDCExercising);
    				// DeleteObject(bmpExercising);
    				EndPaint(hwnd, &ps);
    		}
    		break;
    also added hbitmap

    Code:
    const char g_szClassName[] = "myWindowClass";
    HINSTANCE hInstance;
    
    HBITMAP bmpExercising = NULL;
    
    LRESULT CALLBACK WndProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam)
    {
    //	HDC hDC, MemDCExercising;
     //   PAINTSTRUCT Ps;
      //  HBITMAP bmpExercising;
    Last edited by kryptkat; 06-09-2005 at 12:31 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Bitmap display probelm.
    By hemanth.balaji in forum Windows Programming
    Replies: 11
    Last Post: 05-29-2005, 10:50 PM
  2. OpenGL -- Bitmaps
    By HQSneaker in forum Game Programming
    Replies: 14
    Last Post: 09-06-2004, 04:04 PM
  3. Simple Ddraw question. Display bitmap on a screen.
    By tegwin in forum Game Programming
    Replies: 0
    Last Post: 05-22-2004, 05:50 PM
  4. How to create and display a bitmap programatically?
    By solar3147 in forum Windows Programming
    Replies: 4
    Last Post: 06-24-2003, 02:55 AM
  5. bitmap not going onto screen
    By stallion in forum Windows Programming
    Replies: 4
    Last Post: 02-22-2003, 09:07 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21