|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
||||
|
||||
|
win32 c VS win32 c++?
I was told by a friend that if you choose to learn the windows api that you can choose to code it in c or c++. Is this true? which is a better idea if you know both of them about the same but would need to "brush up"?
Thanks, Dan |
|
#2
|
|||
|
|||
|
The Wintendo API is basically C-oriented. So, if you like, you can use that. If, however, you want to use C++, you'll have to use something to get the API's functionality in an OO way, e. g. via MFC or Qt.
|
|
#3
|
||||
|
||||
|
Basically, everything you can do in C you can also do in C++. So you should be able to take a C program and recompile it in C++. In practice, there may be a few minor errors; e.g., when I first tried it I found that two macros were defined in my C compiler but not in my C++ compiler.
Windows API programming (originally SDK, for "software development kit") is classically done in C. If you read Petzold's books you will find all the code to be in C. MFC and other frameworks are done in C++ in order to encapsulate the message loop and other details of SDK and to provide a set of base classes that you can extend. If you don't want to use a framework (which you are indicating is the case), then you could still do your SDK programming in C++ just for "better C" reasons and for creating and using your own classes for non-GUI purposes. So you could indeed use either C or C++. I would advise using C++ since it would be the upward migration path, it contains all the features of C anyway, and since restricting yourself to C would be over-restrictive for no good reason. |
|
#4
|
||||
|
||||
|
If you look at the MFC classes, quite a lot of them are actually very thin wrappers around the native C API functions. By comparison, Borland's older OWL and newer VCL class libraries are much more object oriented.
Frankly, I learned the basics of Windoze programming from the Petzold book, and then went straight to Delphi, C++ Builder and Visual C++. Before programming in Delphi, I also dabbled with Borland C++'s OWL library a bit. The Petzold background helped quite a bit, when I was programming Visual C++. In fact, I actually ended up writing one project in native C, simply because it had to be as lean and mean as possible. I think it's useful to skim over it, just so that you know how things were done before MFC. That information could come in handy for you too. BTW, I was already a fairly decent C/C++ programmer, before I even did any Windoze programming, so that was at least one hurdle that I didn't have to jump over. Last edited by Scorpions4ever : May 21st, 2003 at 02:35 PM. |
|
#5
|
||||
|
||||
|
Thanks a lot for your help guys, appriciate it!!
Dan |
![]() |
| Viewing: Dev Shed Forums > Programming Languages > C Programming > win32 c VS win32 c++? |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|