While (GetMessage (& MSG, ...)) {
TranslateMessage (& MSG); // Convert button message
DispatchMessage (& MSG); // Delivery message}
The loop in the winmain function, the entire application survival period is determined by the return value of the getMessage, and the application is ended when it returns 0 (ie the WM_Quit message).
The generation of the window is called by the CreateWindow API function in the main function.
The closure window generates WM_CLOSE by the DefWindowProc Clear window and generates a WM_DESTROY message, and the message processing function is defined in the message processing function (postquitMessage) generates a WM_Quit message to exit the program.