Click here to Skip to main content
11,922,877 members (47,853 online)
Rate this:
Please Sign up or sign in to vote.
See more: VC8.0 C++ Win32 MFC

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..
Posted 5-Apr-11 10:18am
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

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.
Hans Dietrich 5-Apr-11 18:46pm
Correct, my 5.
Albert Holguin 5-Apr-11 18:58pm
thank you :)
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

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[^].
Smile | :)
Albert Holguin 5-Apr-11 18:40pm
i believe CBitmap is based on GDI (an MFC wrapper)
CPallini 6-Apr-11 3:00am
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...
Rate this: bad
Please Sign up or sign in to vote.

Solution 3

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.

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

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web03 | 2.8.151125.1 | Last Updated 5 Apr 2011
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100