Revising the WinMain Function

You need to revise the WinMain function if either of the following is true:

  • Your application needs to know when another instance of the application is running, or

  • You need to access the command line.

Otherwise, the code in this function generally needs no change.

The parameter list for WinMain is the same for Win32 and Windows 3.x:

int PASCAL WinMain(hInstance, hPrevInstance, lpCmdLine, nCmdShow)

Note that under Win32, the hPrevInstance parameter is always passed NULL (see the next section, Initializing Instances). As with 16-bit Windows 3.x, the lpCmdLine parameter points to a string containing the entire command line.