Sun Xin MFC Study Notes 1 windows application program running mechanism, mfc1windows
1. MSG structure
Hwnd: Window handle
Message: message Type
WParam & lParam: additional message information (such as key value)
Time: the time when the message is delivered.
Tip: typedef is used to differentiate the usage of a variable from the variable type.
2. WinMain
3. Procedure
4. Design window
5. Create, display, and update Windows
6. Callback Function
Tip: BeginPaint and EndPaint can only be used in response to the WM_PAINT message, while GetDC cannot be used here
Tip: if a constant is equal to a variable in the if statement, you should write the constant on the left (avoid writing =)
Tip: The GetMessage function returns 0 after obtaining a WM_QUIT message; otherwise, it returns a non-0 value (so you can use:
While (GetMessage (& msg, NULL, 0, 0 )){
//...
}
)
Tip: default is required for message loop. The operating system can provide some default message processing functions.
Writing a blog with chrysanthemum is refreshing!