tags:

views:

192

answers:

5

I'm developing a win32 app in the C Programming Language. This is my first experience with the native win32 apis and they seem to be completely brutally unreadable (simple window).

I was wondering if there was a wrapper for the entire API that I could use, instead of having to smash my head with this stuff.

Other frameworks/libs won't do since I want to work with Windows' native api.

Thanks!

A: 

WinForms on the .Net framework is a nice (nearly comprehensive) wrapper around the Win32 windows api.

In the C/C++ world, the ATL api is a (somewhat) higher level alternative to using the raw apis

Scott Weinstein
+1  A: 

Once you understand the code its not that complicated; the main issue is that you need to deal with all the boiler plate stuff yourself and which is where you lose more time. I don't know your situation, but would using a framework like MFC be acceptible? The same window in C is relatively easier in MFC as shown here and it hides some of the boilerplate code. Also there are a few cross platform options such as Qt4, but not sure if those will be acceptible or not.

bahree
+2  A: 

Other GUI frameworks/libs won't do since I want to work with Windows' native api.

If you want to work with the Win32 API... you have to work with the Win32 API. You'll want to get your hands on a copy of Petzold (http://www.charlespetzold.com/pw5/) and go from there. The example you posted is not incredibly complex, once you have seen the explanation for what the code does you will probably be less worried.

MFC/ATL/Qt/wxWidgets will all allow you to get handles to the controls if you need to customise anything.

Is there any particular reason you want to work with the native Win32 API?

taspeotis
yes, I want to distribute the executable in a very *light* size.
Luca Matteis
I'd get that copy of Petzold and start reading. What compiler are you using? If you're using VC2005/2008 you will need to either static link the runtime (increasing size) or make sure you distribute the VC2005/2008 redistributable in advance.If you're going to introduce prerequisites (ie VC redist) why don't you require the .NET Framework and use .NET? .NET binaries can be quite small as they are mostly metadata and code and the .NET JIT compiler takes care of the bigger stuff.Also if you're statically linking (as above, an increase in binary size) can you do C++ and link MFC statically?
taspeotis
Actually, if you configure your project to compile as C and to omit linking to the standard library, you can eliminate the need for static linking or the redistributable. Of course, if you are used to using the C standard library functions, you will need to find Windows API equivalents.
Matthew Xavier
A: 

If you're using pure C, then none of the common frameworks (MFC, ATL, etc) will help you. There might be other libraries (TCL?) but it's going to be fairly evil.

Even today not all of the tutorials online utilize the Message Crackers in Windowsx.h. Make sure you're familiar with those, they will save you some grief and help make your app easier to migrate.

Eric
A: 

Rad Studio which include C++ Builder and the VCL can be a good choice

Hugues Van Landeghem