Every Windows program must have a function named WinMain, which marks the entry point for the program. A program must have only one WinMain function, and you shouldn't use the name elsewhere in your program. The main function is not used in Windows programs.
Below is the simplest possible Windows program:
#include windows.h
int PASCAL WinMain(hInstance, hPrevInstance, lpszCmdLine, nCmdShow)
HANDLE hInstance, hPrevInstance;
LPSTR lpszCmdLine;
{
return FALSE;
}
The first line instructs the compiler to use the WINDOWS.H header file, which is required for all Windows programs.
The next line is the WinMain function. WinMain returns an integer value, which signals if the program terminated normally.
The PASCAL keyword before WinMain instructs the compiler to use the Pascal calling convention for the function when the program is compiled. The Pascal calling convention is described below.
Windows always passes the same four parameters shown above to WinMain. These parameters are fully explained in the Creating Windows Programs section.
The braces ({}) mark the WinMain function's beginning and end, as they do in every function. This program just returns a zero value (FALSE), indicating the program has terminated prematurely. In an actual Windows program, statements and Windows function calls that create windows and read and dispatch input would be inserted in this block.
NOTE:
Although technically QuickC for Windows does allow you to substitute main for WinMain, you should use WinMain for consistency.