dev C++ bitmaps

This is a discussion on dev C++ bitmaps within the Windows Programming forums, part of the Platform Specific Boards category; i've been trying to get a bitmap to work for 2 weeks now, but it never works. tutorials always say ...

  1. #1
    yes, I'm registered!!! algi's Avatar
    Join Date
    Nov 2004
    Location
    Ipswich
    Posts
    161

    dev C++ bitmaps

    i've been trying to get a bitmap to work for 2 weeks now, but it never works. tutorials always say to add resources and stuff and say to in vc++. Can anybody explain to me the code and adding of the resources in dev c++5.

    Thanks in advance
    I started out with nothing and I still have most of it left.

  2. #2
    Reza Djahanbakhshi C++Lover's Avatar
    Join Date
    Mar 2005
    Location
    Iran
    Posts
    2
    This code may help you.

    Code:
    void CMFC07Dlg::ShowBitmapRes(void)
    {
    	CClientDC *dc = new CClientDC(this);
    	HBITMAP hBitmap;
    	hBitmap= LoadBitmap(AfxGetInstanceHandle(),
    		MAKEINTRESOURCE(IDB_BITMAP1));
    	CDC mdc;
    	mdc.CreateCompatibleDC(dc);
    	mdc.SelectObject(hBitmap);
    	dc->BitBlt(10,10,100,100,&mdc,10,10,SRCCOPY);
    }
    
    void CMFC07Dlg::ShowBitmapFile(void)
    {
    	CClientDC *dc = new CClientDC(this);
    	HBITMAP hBitmap = (HBITMAP) ::LoadImage(AfxGetInstanceHandle(),
    		"D:\\WINDOWS\\Coffee Bean.bmp",IMAGE_BITMAP,0,0,
    		LR_LOADFROMFILE|LR_CREATEDIBSECTION);
    	CDC mdc;
    	mdc.CreateCompatibleDC(dc);
    	mdc.SelectObject(hBitmap);
    	dc->BitBlt(10,10,100,100,&mdc,10,10,SRCCOPY);
    }

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. DX9 Not Displaying Bitmaps
    By Sentral in forum Game Programming
    Replies: 9
    Last Post: 01-31-2006, 05:35 AM
  2. New to Dev C++/<windows.h>...
    By Cilius in forum C++ Programming
    Replies: 3
    Last Post: 02-23-2005, 01:05 AM
  3. Glut and Dev C++, Programs not Quitting?
    By Zeusbwr in forum Game Programming
    Replies: 13
    Last Post: 11-29-2004, 08:43 PM
  4. MFC: Multiple clicks shows multiple bitmaps - how?
    By BrianK in forum Windows Programming
    Replies: 0
    Last Post: 06-20-2004, 08:25 PM
  5. Displaying bitmaps on a dialog
    By minesweeper in forum Windows Programming
    Replies: 2
    Last Post: 05-15-2002, 04:11 PM

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