Jump to content
  • Advertisement


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


Loading Bitmaps

This topic is 6924 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

Can someone please help me? I want to get a Bitmap to be displayed on a DC (Plain windows not DirectX or any thing). I got a bitmap in a resource file: IDB_BITMAP and a the handle of a DC: hDC. Can some please tell what functions in what order are needed to load the bitmap and draw it on the DC; Thanks in advance.


Share this post

Link to post
Share on other sites
LoadBitmap to get the bitmap into a HBITMAP if its a resource bitmap. Then use CBitmap::Atach() to attach the handle to the class CBitmap:

Create a memory DC and initialize it:
CDC memDC;

Then, select the CBitmap into the context:
memDC.SelectObject((CBitmap *)theBitmap); // Not sure if you need the cast or not 

Then, draw it by blitting:
hDC.BitBlt(0,0,bitmapwidth, bitmapheight, &memDC, 0, 0, SRCCOPY); 

And CHABOOM, there it is, on the context (usally pDC in OnDraw).

PCMCIA - People Can't Memorize Computer Industry Acronyms
ISDN - It Still Does Nothing
APPLE - Arrogance Produces Profit-Losing Entity
SCSI - System Can't See It
DOS - Defunct Operating System
BASIC - Bill's Attempt to Seize Industry Control
IBM - I Blame Microsoft
DEC - Do Expect Cuts
CD-ROM - Consumer Device, Rendered Obsolete in Months
OS/2 - Obsolete Soon, Too.
WWW - World Wide Wait
MACINTOSH - Most Applications Crash; If Not, The Operating System Hangs

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!