A quick method to load a bitmap file in a CBitmap
Posted
by Ronen Magid
on August 1st, 1999
A Quicker way to load *.BMP files into a CBitmap Object
- Create your own CBitmap derived class (say, CMyBitmap)
- add a "load from bitmap" method as listed below
BOOL CMyBitmap::LoadBitmap(LPCTSTR szFilename)
{
ASSERT(szFilename);
DeleteObject();
HBITMAP hBitmap = NULL;
hBitmap = (HBITMAP)LoadImage(NULL, szFilename, IMAGE_BITMAP, 0, 0,
LR_LOADFROMFILE | LR_CREATEDIBSECTION | LR_DEFAULTSIZE);
return Attach(hBitmap);
}

Comments
A nice work
Posted by Legacy on 09/15/2003 12:00amOriginally posted by: KEYAN
good work.\
ReplyYou are a god
Posted by Legacy on 08/12/2003 12:00amOriginally posted by: Jason
You are a god
Reply
Thanx But....
Posted by Legacy on 05/16/2003 12:00amOriginally posted by: Filali
Thank you for this code
Replybut 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 12:00amOriginally posted by: Peter Horsley
nice werk - this is a genuine gold snipet of code!!!!
thanks a billion ;)
ReplyIt doesn't work with pathnames with directories
Posted by Legacy on 04/28/2003 12:00amOriginally posted by: Sveto
... for example "e:\somefile.bmp". Only works with "somefile.bmp"
-
Replyyes it does
Posted by l00p1n6 on 08/11/2005 02:27pmu have to use "e:\\somefile.bmp"
Replyhow do i start programming for patteren recognition from basics
Posted by Legacy on 02/26/2003 12:00amOriginally 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.
-
Replyimage segmentation
Posted by nmquan2504 on 11/25/2007 06:21ami need it
ReplyOh ya!
Posted by Legacy on 02/25/2003 12:00amOriginally posted by: Mike
I have been looking for this simple method for sooooooo long. Thanks dude!
-
Replygood
Posted by yangds_001 on 05/11/2008 03:00amthank you
ReplyVery nice!!
Posted by Legacy on 11/15/2002 12:00amOriginally posted by: Razvan
Hello
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?
Razvan
ReplyThanks, this is what I needed
Posted by Legacy on 09/20/2002 12:00amOriginally 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 :)
ReplyLoading many picture frames
Posted by Legacy on 12/14/2001 12:00amOriginally posted by: CK
Hi,
May I know how I can go about loading many picture frames, instead of just 1.... thanks...
ReplyLoading, Please Wait ...