Click here to Skip to main content
15,443,281 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:

how can i use afxwin.h in a win32 based application...
I want to use CBitmap to load an image..
what i;ve to do if i want to use CBitmap in win32 based application...


help me out..

In order to use CBitmap, you must specify that the application is MFC based when creating a project. If you have code that you already have that you want to use within an MFC application, you can build an MFC application shell then just pull your code in. Shouldn't be terribly hard to do so. If you don't want to use MFC, you can interface directly to the GDI API as cpallini stated.
Share this answer
Hans Dietrich 5-Apr-11 18:46pm    
Correct, my 5.
Albert Holguin 5-Apr-11 18:58pm    
thank you :)
As far as I know you cant use CBitmap without using MFC. However you may use the powerful Image class of GDI+, see, for instance Loading and Displaying Bitmaps[^].
Share this answer
Albert Holguin 5-Apr-11 18:40pm    
i believe CBitmap is based on GDI (an MFC wrapper)
CPallini 6-Apr-11 3:00am     CRLF
True. But the OP may as well use GDI+: Image class is, at least, more 'user friendly' than CBitmap one.
Albert Holguin 6-Apr-11 10:40am    
I wouldn't necessarily agree with that, if you know MFC, CBitmap's very user friendly...
Just a note to add to what Albert said: you can statically link with MFC, so that the MFC DLLs do not need to be on the machine where you want to run your app.
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900