# Article on Windows Programming
#
# By Gendor of the Apocalypse Clan

Well, this is my first tut, so nobody get hung up on any typos or grammar mistakes, OK? ;-) First of all I want to warn all newbies to first get to grips with C and C++ before even attempting Windows 32-bit (Win32) programming. It might also help to get a decent compiler like M$ Visual Studio 6 or Borland C (or even Cygnus or LCC-win32 if you're broke )

The mission of this tutorial is to give the DOS coder some insight into the world of Windows, not to teach you everything you need to know about this OS. In my opinion, I'd rather use Linux - but my current set-up won't allow it. ;-) Oh yeah, before I forget, go to http://www.gaffer.org/ptc for Prometheus Truecolor Library, the definitive graphics library for Windows. (Heck, with PTC you can even port it to the OS of your choice! :-)

So, have u ever seen Win32 code? If not, here's some:

Huh, what? Well, don't be afraid.. be VERY afraid - lol! No, once you learn to read between the "lines" and don't worry about the Hungarian notation (can u believe it, M$ coders dedicating the way they code to some dead guy ;-) The part of your program shown above is kinda like the Main function in your normal C program.

Ever heard of event-driven programming? That's when your program hangs around (like a skateboarder ;-) until something happens, and then reacts to it. This creates some problems when programming demo's, because you have to share the CPU with a few other programs, and you have to wait until Windows sends you a message, so you can react to it. That's what happen in the GetMessage part.. after that, your program translates and dispatches the message to your WinProc function, which deals with each message and tells it what to do (draw a triangle, play a tune, or crash the OS :-)

The big problem with Windows coding is the major amount of overhead you have to work with even when creating the smallest of programs. But, guess what?! There's ppl who've actually written a 4kb intro in Win32!* Compared to the normal size of 100KB for even smaller programs, that's quite an achievement. * Note to Rawhed - The intro was written in full assembler (TASM32), so there's hope for u! ;-)

Ready for some more code? OK, let's shock ya:

All this code just to set up one window? Yeah, and that's not even all the parameters! What actually happens is that you set up a class for your window, register it, create it with some more code and then show it on screen. Remember to update it too! :-)

If you ask me that's quite a lot of code for one small window! OK, let's see some PTC code.. Remember that this is a full program designed to put a pixel on the screen..

Remember that this code is DirectX optimised, and can be converted to any platform just by switching the compiler! If u've ever looked at DirectX code, u will realise that this is DEFINITELY much easier and shorter.. Yeah, you read right, shorter! :-)

Windows may have more overheads and generate bigger code. But, you don't have to worry about what videocard the guy uses, or even the soundcard he plays with!

Hope you found some of this useful!

Gendor /Apocalypse
All comments/suggestions can be sent to
gendor@mweb.co.za
Plz, I need feedback! :-)