-
Book Overview & Buying
-
Table Of Contents
C++ Windows Programming
By :
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 application
prevInstanceHandle: This is present due to backward compatibility but is always null
commandLine: This is a null-terminated character (char, not TCHAR) array holding the arguments for the application, separated by spaces
commandShow: This holds the preferred appearance of the main window
WinMain.cpp
#include "SmallWindows.h"
int WINAPI WinMain(HINSTANCE instanceHandle,
...