The WinMain function
In the Win32 API, WinMain
is the function equivalent to main
. Each application must include the definition of the WinMain
function. In order for Small Windows to work, WinMain
is implemented as a part of Small Windows, while MainWindow
has to be implemented by the user of Small Windows for each project. To sum it up, here are the three kinds of main functions:
Regular C/C++ |
Win32 API |
Small Windows |
main |
WinMain |
MainWindow |
The WinMain
function is called by the Windows system and takes the following parameters:
instanceHandle
: This holds the handle of the applicationprevInstanceHandle
: This is present due to backward compatibility but is alwaysnull
commandLine
: This is a null-terminated character (char
, notTCHAR
) array holding ...
Get C++ Windows Programming now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.