Now, a brief introduction to the general operation of Windows applications, so that the first contact with Windows Development or MFC development students have a rough understanding.
1. Create a window first register a window class, initialize each field in the Wndclass, and set the window procedure function.
2. Call Rigisterclass to register this window class.
3. Create a window. CreateWindow
4. display window. ShowWindow
5. Refresh the window. UpdateWindow
5. Message loops.
The message loop is mainly explained here.
Loops in a message loop are in the program
while(GetMessage(&msg,NULL,0,0)){ TracslateMessage(&msg); DispatchMessage(&msg);}
This structure works.
In general, clicking on the Windows window will put the event into a message queue owned by the program.
The MSG message is then removed from the loop code above and dropped to the system.
The system calls the window function of the window class that the program belongs to, and passes the message to the function, and at last determines what information is in the function and performs the corresponding feedback according to the information.
The above is the general window response process.
Let's remember these key functions. It is these functions that push the whole program to run.
Windows window program run process