Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

suppressing the freezing of application?

Status
Not open for further replies.

Cenkovic

Technical User
Jan 6, 2004
3
CZ
Dear Delphi users,
I am a new user of Delphi and I apologize for my poor English. I have this problem. We have a measuring device which sends the data through the port to the computer. This measurement should be instant, so I think there should be an infinite loop in the program. For the reading data from the port we will have a DLL file, which its functions will assure this. My question is how to eliminate the freezing of the computer to have control of the application. I have tried the procedure Application.ProcessMessages and Application.OnIdle which does not work. Thank you for your advice. Tomas Cenkovic
 
in your measurement loop add this line :

var i : integer;

...
inc(i);
if i mod 1000 then Application.Processmessages
Sleep(20);
....


this will ensure that your app won't take 100% cpu time and leave time to other threads

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top