WinMain() is the C entry point function of any windows application. Like normal DOS/console based application which has main() function as C entry point, in windows we have WinMain() instead. WinMain() is a function which is called by system during creation of a process. First argument is the instance handle of the current process. Next is the previous instance. Command line arguments comes as next argument. Finally shell passes the show/display attribute of main window. WinMain() returns success as zero and error as non zero.
The WinMain function is called by the system as the initial entry point for a Win32-based application.
Syntax:
int WINAPI WinMain(
HINSTANCE hInstance, /* [input] handle to current instance */
HINSTANCE hPrevInstance, /* [input] handle to previous instance */
LPSTR lpCmdLine, /* [input] pointer to command line */
int nCmdShow /* [input] show state of window */
);