Starting point for win32 based applications is WinMain()

WinMain begins by calling the API function RegisterClass to register a window class.

The window class(WNDCLASS) defines important characteristics of a window such as its window procedure address, its default background color, and its icon.
Once the WNDCLASS is registered, WinMain calls the all-important CreateWindow function to create the application's window.

WinMain follows CreateWindow with calls to ShowWindow and UpdateWindow, which make the window visible and ensure that its WM_PAINT handler is called immediately.

Next comes the message loop. In order to retrieve and dispatch messages, WinMain executes a simple while loop that calls the GetMessage, TranslateMessage, and DispatchMessage API functions repeatedly.

GetMessage checks the message queue. If a message is available, it is removed from the queue and copied to msg;
TranslateMessage converts a keyboard message denoting a character key to an easier-to-use WM_CHAR message,
and DispatchMessage dispatches the message to the window procedure. The message loop executes until GetMessage returns 0, which happens only when a WM_QUIT message is retrieved from the message queue. When this occurs, WinMain ends and the program terminates.