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)