The definition of WinMain
is:
int CALLBACK WinMain(
_In_ HINSTANCE hInstance,
_In_ HINSTANCE hPrevInstance,
_In_ LPSTR lpCmdLine,
_In_ int nCmdShow
);
What I understand is:
hInstance
is a handle to the application's instance and can, when not a DLL, be retrieved withGetModuleHandle(NULL)
szCmdLine
is the command line arguments and can be retried withGetCommandLine()
nCmdShow
is usuallySW_SHOW
However, never have I come across any usage of hPrevInstance
, even in books from the late 1990s. So, what, if any, is the use of hPrevInstance
, and what exactly is it?
That's a legacy thing. Raymond Chen provides a good explanation on The Old New Thing (dated 15 June 2004). Here it is (with corrected links):