Reference Link: http://www.cnblogs.com/huangygdelphi/articles/1896944.html
Https://zhidao.baidu.com/question/471496371.html
Problem Source: http://www.cnblogs.com/del/archive/2011/05/09/2041290.html
The biggest effect is to reduce the suspended animation. For example, when you execute a very large loop statement, this time the program has been executing this cycle, then the program has been absorbed in the execution, it gives the impression that the program is dead, but actually not.
If you add application.processmessages, you will have time to do something else when the loop is executed (you can click on other buttons or something).
Application. The main function of processmessages is to enable the program to respond to external events in the loop.
In general, the program does not respond to external events when looping. No external events can be accepted and responded to until the end of the loop.
Application. ProcessMessages can effectively solve the monopoly problem of circular loops, and can temporarily interrupt the execution of the application.
For example, to design a calculation, this calculation needs to be cycled 10,000 times. When the loop starts to 500 times, the user suddenly does not want to calculate, it wants to cancel the calculation, this time you can set a Cancel button, and then in the loop body inside the appropriate position application. ProcessMessages. To process the Cancel button information and interrupt the loop.
If you have no application in the circulation body. ProcessMessages this sentence. When the loop starts, the program is monopolized by the loop 10,000 times until the end of the loop. During the cycle, the user presses whatever buttons are not used.
The role of Application.processmessages