Board index » delphi » Unresponsive Program problem

Unresponsive Program problem

You should call "Application.ProcessMessages" in Your loops. Then will
messages to Your program will be handled.

Thore Berntsen
Norway
thbe...@online.no

Roy H. Jennings, Jr. <jenni...@meltech.com> skrev i artikkelen
<01bc39f4$17e55440$35cdddcf@rjennings>...

Quote
> I have a Delphi 2 app that has several routines that execute tight loops

for extended periods of time. During this time the application is totally
unresponsive to, among other things, Paint messages.
Quote

> Does anyone know how to fix this?

> Thanks,
> --
> Roy H. Jennings, Jr.
> Melton Technologies, Inc.
> jenni...@meltech.com

 

Re:Unresponsive Program problem


SSBoYXZlIGEgRGVscGhpIDIgYXBwIHRoYXQgaGFzIHNldmVyYWwgcm91dGluZXMgdGhhdCBleGVj
dXRlIHRpZ2h0IGxvb3BzIGZvciBleHRlbmRlZCBwZXJpb2RzIG9mIHRpbWUuIER1cmluZyB0aGlz
IHRpbWUgdGhlIGFwcGxpY2F0aW9uIGlzIHRvdGFsbHkgdW5yZXNwb25zaXZlIHRvLCBhbW9uZyBv
dGhlciB0aGluZ3MsIFBhaW50IG1lc3NhZ2VzLg0KDQpEb2VzIGFueW9uZSBrbm93IGhvdyB0byBm
aXggdGhpcz8NCg0KVGhhbmtzLA0KLS0gDQpSb3kgSC4gSmVubmluZ3MsIEpyLg0KTWVsdG9uIFRl
Y2hub2xvZ2llcywgSW5jLg0KamVubmluZ3NAbWVsdGVjaC5jb20NCg==

Re:Unresponsive Program problem


Roy H. Jennings, Jr. <jenni...@meltech.com> skrev i inl?gg
<01bc39f4$17e55440$35cdddcf@rjennings>...

Quote
> I have a Delphi 2 app that has several routines that execute tight loops

for extended periods of time. During this time the application is totally
unresponsive to, among other things, Paint messages.

Quote

> Does anyone know how to fix this?

> Thanks,
> --
> Roy H. Jennings, Jr.
> Melton Technologies, Inc.
> jenni...@meltech.com

Hi Roy!

        One command to use is the "Application.processmessages" which will empty
the Windows command-queue, but I don't think that will help you. The
program will probably stall anyway.
        I experienced the same problem myself when I tried to use my old familiar
Turbo Pascal-style as a newbie at Delphi 2, but I soon realised that I had
to take the multi-tasking into account and write the routines accordingly.
        In other words, I don't think you can use repeat..until, do..while and so
on for an extended time since it messes up the multi-tasking in Win95. I've
abandoned them completely and replaced them with event-handlers instead.
        For instance, I wrote an application that should scan COM1 for incoming
data from an external device, and I put the scanning code in an
repeat..until since I thought my application shouldn't do anything else but
present the incoming data while monitoring the port. But it {*word*30}ed up just
like you described and I ended up having to use a built-in event handler
that instead called a procedure when x characters where available in the
in-buffer. The procedure ran from the first line through to the last,
presented the data and then ended. That fixed the problem.

        If you'd like to continue this discussion, please write to me and tell me
more precisely what your routines are supposed to accomplish, ok?

With hope of helping,

<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
Daniel Persson, Malmoe, Sweden
daniel.pers...@swipnet.se

Quote

Other Threads