Strengthen the concept: The program itself does not pick up the message, the message will not run on its own (for messages in the thread message queue, but also the vast majority of messages)

Source: Internet
Author: User
Tags message queue

Just looking at this code:

proceduretcontrol.setbounds (Aleft, ATop, Awidth, Aheight:integer);begin  ifChecknewsize (Awidth, Aheight) and((Aleft<> fleft)or(ATop <> Ftop)or(Awidth<> fwidth)or(Aheight <> fheight)) Then  beginInvalidateControl (Visible, False); Fleft:=Aleft; Ftop:=ATop; Fwidth:=Awidth; Fheight:=Aheight;    Updateanchorrules;    Invalidate; Perform (wm_windowposchanged,0,0);    Requestalign; if  not(csloadinginchComponentstate) ThenResize; End;End;

Suddenly found that InvalidateControl has declared some invalid area, then WM_PAINT will immediately send to run it? Or will you continue to run fleft: = Aleft; statements and invalidate statements? My view is that the code of the above functions is executed consecutively. The WM_PAINT message may have been sent to the thread message queue before the invalidate statement (but it is only possible), but it has no chance of being removed by the program because the current program is busy and has no chance to invoke the message loop in the run () function. So you don't have to worry about the WM_PAINT message in the middle of the function execution process is confusing, it does not have this opportunity.

Even if SendMessage does not take the message queue, it calls the WinProc function directly, but that is also the order execution statement. In a single-threaded case, without a sendmessage statement, it has no chance of executing code, no chance of messing up other code, and no chance to mess up its current function.

Strengthen the concept: The program itself does not pick up the message, the message will not run on its own (for messages in the thread message queue, but also the vast majority of messages)

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.