Friday, October 15, 2010

The Basic Windows Application

Windows programming is not difficult at all. Let's see the most common and basic program in this world: the Hello, World! program. If you’ve seen any elementary DOS-based C or C++ code, chances are that you’ve seen this code:

// Hello, world! program
#include 
void main()
{
 printf("Hello, world!\n");
}

And this is how it look's "Hello, World!" Windows style.

#include  // main Windows headers

// the main entry point to your program
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine,
int nShowCmd)
{
 // show a very simple message box with the text “Hello, world!” displayed
 MessageBox(NULL, TEXT("\tHello, world!"), TEXT("My First Windows Application"), NULL);
 return 0;
}

compiled with vs 2008 express

No comments:

Post a Comment