Sun Xin MFC Study Notes 1 windows application program running mechanism, mfc1windows

Source: Internet
Author: User

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!

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.