Difference between updatewindow and invalidate

Source: Internet
Author: User

Difference between updatewindow and invalidate

 

Msdn explanation
Updatewindow
The updatewindow function updates the client area of the specified window by sending a wm_paint message to the window if the window's update region is not empty. the function sends a wm_paint message directly to the window procedure of the specified window, bypassing the application queue. if the update region is empty, no message is sent.

Invalidaterect
The system sends a wm_paint message to a window whenever its update region is not empty and there are no other messages in the application queue for that window.

A rough explanation of the Translation into Chinese is as follows:
Updatewindow: If there is no effect zone, the sending a wm_paint message will be sent to the window for processing immediately. If the message queue is not entered for waiting, the window will be refreshed immediately. Otherwise, nothing will be done.
Invalidaterect: Set the invalid partition. If the parameter is null, set the entire window to an invalid partition. When the applicationProgramWhen the message queue in the window of is empty, sending a wm_paint message (even if the update area is empty) will be accumulated in all invalidaterect update areas of sending a wm_paint message.

 

So the general usage is

1: Set invalid Zone
Invalidaterect

2: refresh now
Updatewindow ();

if you call updatewindow without calling invalidaterect, The updatewindow does not do anything.
If updatewindow is not called after invalidaterect is called, the system automatically sends a wm_paint message when the window message queue is empty.

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.