The role of Application.processmessages

Source: Internet
Author: User

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

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.