Click to See Complete Forum and Search --> : From Bitmap File to HBITMAP


balak yap
May 11th, 1999, 09:39 PM
Hello;
I would like to know, is it possible to get the HBITMAP from a *.bmp (or *.dib) without show the
file into a HDC? Anyone can show me a easy way to do this in Win32/MFC?
Thanks


Hello World!!!

Jason Teagle
May 12th, 1999, 03:12 AM
The ::LoadImage() function returns a handle which can be cast to an HBITMAP (I believe), although you can't load from file using this function under NT (for some stupid reason).

Rajesh Makhija
May 12th, 1999, 06:50 AM
LoadImage along with some extra code can be used to read a BMP file. Refer to Article ID: Q158898 "How To Use LoadImage() to Read a BMP File" in MSDN.
You can use ::ReadDIBFile for *.dib files. Refer to DIBLOOK example of MSDN for the same

Hope this helps