Virtual Developer Workshop: Containerized Development with Docker

A Quicker way to load *.BMP files into a CBitmap Object

  1. Create your own CBitmap derived class (say, CMyBitmap)
  2. add a "load from bitmap" method as listed below

BOOL CMyBitmap::LoadBitmap(LPCTSTR szFilename) 

	HBITMAP hBitmap = NULL; 
	hBitmap = (HBITMAP)LoadImage(NULL, szFilename, IMAGE_BITMAP, 0, 0, 
	return Attach(hBitmap); 


  • A nice work

    Posted by Legacy on 09/15/2003 07:00am

    Originally posted by: KEYAN

    good work.\

  • You are a god

    Posted by Legacy on 08/12/2003 07:00am

    Originally posted by: Jason

    You are a god

  • Thanx But....

    Posted by Legacy on 05/16/2003 07:00am

    Originally posted by: Filali

    Thank you for this code
    but can u please tell us
    how to access to a specific Pixel int the bitmap
    i mean the rgb values
    Thanx in advance

  • nice 1

    Posted by Legacy on 05/15/2003 07:00am

    Originally posted by: Peter Horsley

    nice werk - this is a genuine gold snipet of code!!!!

    thanks a billion ;)

  • It doesn't work with pathnames with directories

    Posted by Legacy on 04/28/2003 07:00am

    Originally posted by: Sveto

    ... for example "e:\somefile.bmp". Only works with "somefile.bmp"

    • yes it does

      Posted by l00p1n6 on 08/11/2005 09:27pm

      u have to use "e:\\somefile.bmp"

  • how do i start programming for patteren recognition from basics

    Posted by Legacy on 02/26/2003 08:00am

    Originally posted by: shivaji

    i did not understand how to start off with writing an application which involves an image input (code).I have to learn this in order to accomplish a small image segmentation problem (in VC++).

    can you please guide me .

    thank you.

    • image segmentation

      Posted by nmquan2504 on 11/25/2007 02:21pm

      i need it

  • Oh ya!

    Posted by Legacy on 02/25/2003 08:00am

    Originally posted by: Mike

    I have been looking for this simple method for sooooooo long. Thanks dude!

    • good

      Posted by yangds_001 on 05/11/2008 10:00am

      thank you

  • Very nice!!

    Posted by Legacy on 11/15/2002 08:00am

    Originally posted by: Razvan


    Actually you are loading a DIB in a CBitmap; after that you can just StretchBlt the DIB to any device (screen, printer) and the conversion from DIB to DDB is done automatically!!
    Well... that means that the function StretchDIBits is NOT required any more... perhaps I didn't understood something here...
    Is StretchDIBits() required when using this technique?


  • Thanks, this is what I needed

    Posted by Legacy on 09/20/2002 07:00am

    Originally posted by: cc

    I've been searching days for a solution to import a bmp image from a file, and all MS documents and samples I found only show how to add a BMP image from the resource file (staticly). Your a life saver :)

  • Loading many picture frames

    Posted by Legacy on 12/14/2001 08:00am

    Originally posted by: CK


    May I know how I can go about loading many picture frames, instead of just 1.... thanks...

  • Loading, Please Wait ...

  • You must have javascript enabled in order to post comments.

Leave a Comment
  • Your email address will not be published. All fields are required.

Most Popular Programming Stories

More for Developers

RSS Feeds

Thanks for your registration, follow us on our social networks to keep up-to-date