Important: |
---|
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist. |
This function is called by the system as the initial entry point for WindowsCE-based applications.
int WINAPI WinMain( HINSTANCE hInstance , HINSTANCE hPrevInstance , LPWSTR lpCmdLine , int nShowCmd ) ;
Parameters
If you need to detect whether another instance already exists, create a uniquely named mutex using the CreateMutexfunction. CreateMutexwill succeed even if the mutex already exists, but the GetLastErrorfunction will return ERROR_ALREADY_EXISTS. This indicates that another instance of your application exists, because it created the mutex first.
Value | Description |
---|---|
SW_HIDE | Hides the window and activates another window. |
SW_SHOW | Activates a window and displays it in its current size and position. |
SW_SHOWNA | Displays a window in its current state. The active window remains active. |
SW_SHOWNOACTIVATE | Displays a window in its most recent size and position. The active window remains active. |
SW_SHOWNORMAL | Activates and displays a window. If the window is minimized or maximized, the system restores it to its original size and position (same as SW_RESTORE). |
Return Values
The exit value contained in that message's wParamparameter indicates success, and that the function terminates when it receives a WM_QUIT message. Zero indicates that the function terminates before entering the message loop.
Remarks
Your WinMainshould initialize the application, display its main window, and enter a message retrieval-and-dispatch loop that is the top-level control structure for the remainder of the application's execution. Terminate the message loop when it receives a WM_QUIT message. At that point, your WinMainshould exit the application, returning the value passed in the WM_QUIT message's wParamparameter. If WM_QUIT was received as a result of calling PostQuitMessage, the value of wParamis the value of the PostQuitMessagefunction's nExitCodeparameter.
Requirements
Runs on | Versions | Defined in | Include | Link to |
---|---|---|---|---|
Windows CE OS | 1.0 and later | Winuser.h |
Note This API is part of the complete Windows CE OS package as provided by Microsoft. The functionality of a particular platform is determined by the original equipment manufacturer (OEM) and some devices may not support this API.
See Also
DispatchMessage, GetMessage, PostQuitMessage, TranslateMessage