Win32 API

The WinAPI
The Win32 API, or WinAPI, is classified as the entire Windows library and its functions, branching from windows.h, it includes GDI (wingdi.h), and many other core windows platforms.

Most windows programs require Win32 at the core of operation, from simple windows to giant games. The WINAPI WinMain function is the Windows equivalent of int main, and has its own syntax that all windows programs must follow. First, programs must include windows.h.

WinMain
Once windows.h is included, you must add an entry point for the program. Instead of using the familiar function, you must use the WinMain function. Let's have a look at the prototype declared in the Windows API.

The prototype is:

Now we will break it down into its pieces.

simply designates that the return value of the function is an Integer, just like with.

is a strange tag that goes before all Win32 API function overrides. Its purpose is complicated, I won't go over it here.

is the name of the function. Its purpose is obvious.

is one of the required command line arguments for the function. It specifies the application's Instance ID and is used in window creation.

is the ID of any previous instances of the application. This is used by screen savers and games to make sure you don't open two copies of the program at once.

is a pointer to the char array containing the command-line arguments passed to the program. This pointer can be treated like a string.

is the parameters passed to the program determining how to display the window. This variable is used in window creation.