views:

1903

answers:

13

I have very little experience building software for windows, and zero experience using the windows API, is there a good (preferably online), free resource to learn how to use the windows API(preferably with python)?

+16  A: 

Honestly, no. The Windows API is an 800 pound monster covered with hair. Charlie Petzold's 15 pound book was the canonical reference once upon a time.

That said, the Python for Windows folks have some good material. Microsoft has the whole API on line, including some sample code and such. And the Wikipedia article is a good overview.

Charlie Martin
+1 for the awesome description :)
Jeremy Cantrell
Petzold's book still is the canonical reference
Eli Bendersky
+3  A: 

Learning Win32 API is 5% of initial understanding of concepts and the patterns used and 95% of RTFM.

For those initial 5% the Petzold book is really good but I suspect that there ought to be some online tutorials which you can find in google as good as I can to find.

Really, once you get the hang of it it's really straight forward do to be able to do anything. Once you get there it would probably be time to move on to something better like QT and never touch Win32 API ever again. Nowadays no one really uses bare Win32 API for anything more than trivial due to the sheer overhead it involves and the extreme lack of comfort.

shoosh
I use the Windows API all the time. Actually, I use my *understanding* of the Windows API all the time when troubleshooting problems and writing code, even when working with a framework.Don't be fooled. You may not always call the API directly, but you will be a better programmer if you know it.
Mick
A: 

As Charlie says : "this Api is an 800 pound monster covered with hair".

Consider using the express version (free) of visual studio for vb or c# (http://www.microsoft.com/express/) along with the msdn library (http://msdn.microsoft.com/en-us/library/default.aspx). this will give you as much exposure to the api as you want.

Ray Tayek
A: 

Once upon a time I read over some Win32 API tutorials at www.relisoft.com

They are an anti-MFC and pro-Win32 API shop and have a manifesto of sorts explaining practical reasons for why.

They also have a general C++ tutorial. 99% of the time I like their programming style for what it's worth.

A: 

All you need is completely free on MSDN.COM. Win32 is easily programed using C/C++, C#, and Visual Basic. I recommend C/C++. YOu can download the Visual Studio Express editions here.

All the documentation (not an abbreviated form) is on the web here.

Note that Win32 is often loosely used to mean "all the programming interface for Windows". More cannonically, it is the base native set of APIs for user mode applications. There a similar set of APIs for drivers and kernel components. You can learn about that here.

Microsoft has many other windows programming interfaces as well: The Common Language Run time and .NET frame work is a manged layer on top of windows. There are many other API families as well such as DX9 and DX10 (good link to game programming here).

Foredecker
The question states python so I don't think that recommending c(++) is really a good answer.
Unkwntech
He did say "preferably python" The problem is that the WIn32 API is a C/C++ API. Phtyon doesn't directly expose it. If he wants to learn the API, then he should program in its native language.
Foredecker
+3  A: 

I strongly recommend theForger's Win32 API Tutorial. Its a C tutorial, but he pretty much holds your hand and shows you the basics. Its also pretty short, which is nice in a tutorial.

Giovanni Galbo
The tutorial you recommended is awesome!
Mick
Thanks for that! very hands on and gets on with it right away!
Ram Bhat
+1  A: 

Since you've asked about Python, why do you need the Win32 API ? That's used for writing small, fast C/C++ programs. If your tool is Python, just download wxPython which runs wonderfully on Windows and produces sleek native GUIs with 1% the code and the effort.

Eli Bendersky
Plus it should prove easier to port it to other systems.
Brad Gilbert
Unless of course one needs to accomplish a specific task that can only be done with the windows api, and doesn't know C(++/#)
Unkwntech
+1  A: 

" > free resource to learn how to use the windows API (preferably with python)

  1. You may refer Python Programming on Win32 by Mark Hammond and Andy Robinson along with pywin32.

  2. If you are not interested to use pywin32, you can use ctypes — A foreign function library for Python and the Forger's Win32 API Programming Tutorial.

  3. Refer Example Code : Shared Memory with Mutex (pywin32 and ctypes)

bhadra
+5  A: 

Avoid tutorials (written by kids, for kids, newbie level) Read the Petzold, Richter, Pietrek, Russinovich and Adv. Win32 api newsgroup news://comp.os.ms-windows.programmer.win32

+9  A: 

About 4 years ago I set out to truly understand the Windows API. I was coding in C# at the time, but I felt like the framework was abstracting me too much from the API (which it was). So I switched to Delphi (C++ or C would have also been good choices).

In my opinion, it is important that you start working in a language that creates native code and talks directly to the Windows API and makes you care about buffers, pointers, structures, and real constructs that Windows uses directly. C# is a great language, but not the best choice for learning the Windows API.

Next, buy Mark Russinovich's book "Windows Internals" Amazon link. This is the 4th edition. The 5th edition is coming out next month and adds info about Server 2008 and Vista.

And now, for the most important (and best) resource for learning Win32 API:

Mark Russinovich's Windows Operating Systems Internals Curriculum which is offered for free.

It is designed to be used by an instructor to teach students. I went through it and it is awesome. Full of examples, history, and detailed explanations. In my opinion, this is an ideal way to learn the Windows API.

Mark Russinovich is a Microsoft Technical Fellow (there are only 14 at MS including the creator of C#). He used to own Winternals until he sold it to MS, he has a PhD in Computer Engineering from Carnegie Mellon, he has been a frequent presenter at Microsoft conferences (even before he worked for them), and he is crazy smart. His presentations are one of the primary reasons I attend Microsoft TechEd every year.

Mick
Thanks for the link to Windows Operating Systems Internals Curriculum. I never knew that existed.
Justin
+1 for "Windows Operating Systems Internals Curriculum" I too didn't know it existed.
claws
A: 

Umm...a lot of people have put the cart before the horse on this one. The question I have for you is: why do you want to learn Win32?

If you want to learn it so you can build Windows user interfaces, perhaps consider wxPython instead. If you only plan on calling into non-visual Win32 APIs then the Petzold book may not be the best. There are tools like SWIG that make calling libraries such as Win32 easier from languages like Python.

BrianLy
I disagree, learning low level first gives you a firm footing in all windows programming. Learning win32 lets you know whats going on under the hood.
Justin
A: 

You have to start with these two books.

Petzold book: Great for learning messages and message pumps, GDI and User32 stuff.

Richter book: The windows base services, viz. Processes, memory, threads and dlls

m-sharp
A: 

A subquestion Which would be the best language to learn the API in? in terms of ease of use and debugging and popularity?

Ram Bhat
If you want to ask this question I highly suggest that you post a new question.
Unkwntech