Application.processmessages usage

Source: Internet
Author: User

Reference: http://cqujsjcyj.iteye.com/blog/380926

I think you may still be a little vague. For example, it is easy to understand that if you have two buttons on your form, a "calculation", a "stop",

  If your calculations are intensive or complex, when you click the "Calculate" button, you will find that the "stop" buttons do not respond to your clicks, which means that you cannot stop the calculation process at any time. And if you add application.processmessages to the calculated code, Your program will have a chance to respond to other events.

In a large number of cyclic operations, and do not want to use multi-threading, for the computer in the operation can respond to the user's operation, without destroying the instruction execution. The function is similar to the Doevent method in VB.

Procedure delay (msecs:longint);//delay function, Msecs unit is milliseconds (1 seconds in thousands) var  firsttickcount, Now:longint;begin  Firsttickcount: = GetTickCount (); repeat  application.processmessages;  Now: = GetTickCount (), until (Now-firsttickcount >= msecs) or (now < firsttickcount); end;

  

Application.processmessages usage

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.