Windows program and VC message processing Getting Started

zhaozj2021-02-16  180

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.

转载请注明原文地址:https://www.9cbs.com/read-8450.html

New Post(0)