Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Loading a Bitmap

Status
Not open for further replies.

somnath74

Technical User
Mar 5, 2002
24
0
0
IN
Hi,
I have created a bitmap and trying to load it but on debugging I find that the LoadBitmap function is returning 0 i.e it is failing.What are the reasons because of which this might fail?

Thanks

Somnath
 
LoadBitmap has been deprecated, not that this is the reason for failure. But LoadBitmap assumes that your image is bound to the executable. I assume you have done this?

If the image is a file on disk use:

HBITMAP m_bmpIMG ;

m_mmpIMG = (HBITMAP) LoadImage(NULL, _T("images//my.bmp"), IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE | LR_DEFAULTCOLOR) ;

to load it.

You can then use the SetBitmap() member function of the control to set the bitmap.

HTH
William
Software Engineer
ICQ No. 56047340
 
Oops! Excuse the obvious typo in the above the line should be:

m_bmpIMG = (HBITMAP) ...

:)

William
Software Engineer
ICQ No. 56047340
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top