Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: VC8.0 Win32 C++/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 10: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 at 5-Apr-11 18:46pm
   
Correct, my 5.
Albert Holguin at 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 at 5-Apr-11 18:40pm
   
i believe CBitmap is based on GDI (an MFC wrapper)
CPallini at 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 at 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
0 Marcin Kozub 265
1 Richard MacCutchan 239
2 OriginalGriff 208
3 Sergey Alexandrovich Kryukov 185
4 Praneet Nadkar 167
0 OriginalGriff 7,913
1 Sergey Alexandrovich Kryukov 7,232
2 DamithSL 5,604
3 Manas Bhardwaj 4,986
4 Maciej Los 4,865


Advertise | Privacy | Mobile
Web04 | 2.8.1411023.1 | Last Updated 5 Apr 2011
Copyright © CodeProject, 1999-2014
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