Click here to Skip to main content
12,400,556 members (62,145 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: VC8.0 C++ Win32 MFC
HI.

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 9:18am
perry.p538
Rate this: bad
 
good
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.
  Permalink  
Comments
Hans Dietrich 5-Apr-11 18:46pm
   
Correct, my 5.
Albert Holguin 5-Apr-11 18:58pm
   
thank you :)
Rate this: bad
 
good
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 | :)
  Permalink  
Comments
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
 
good
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.
  Permalink  

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
Web02 | 2.8.160721.1 | Last Updated 5 Apr 2011
Copyright © CodeProject, 1999-2016
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