YOUR FIRST WINDOWS PROGRAM

In their classic book The C Programming Language (2d ed., Prentice Hall, 1988), Brian Kernighan and Dennis Ritchie begin discussing C with the now-famous ”Hello, world“ program:

#include <stdio.h>

main ()

{

printf ("Hello, world\n") ;

}

In the remainder of this chapter, I will show you the analogous program written for Microsoft Windows. The program is called HELLOWIN, and it creates a window that displays the text string ”Hello, Windows!“

Lest you collapse from shock when you first look at the HELLOWIN code, I'll warn you now that there are three files involved, and that the HELLOWIN.C source code file is over 80 lines long. Most of these 80 lines are overhead. You'll have similar overhead in almost every Windows program you write.

Rather than ask why the ”Hello, Windows“ program is so long and complex, let's ask why the traditional ”Hello, world“ program is so short and simple.