I think now from memory, the problem was someone clicking a button while in the sleep loop. It was rare but was causing some sort of deadlock. What I could try is to set the mainform.enabled := false at the top of the procedure and enable at the bottom to prevent that situation and put Application.ProcessMessages back. I’ll give that a go.
From: Ross Levis [mailto:ross@stat...]
Sent: Tuesday, 15 May 2012 3:02 p.m.
To: 'NZ Borland Developers Group - Delphi List'
Subject: RE: [DUG] Hang during Sleep
I was using ProcessMessages in the sleep loop but it was causing problems and was removed. I don’t recall the problem now but I think some event was being executed while in the loop and caused some problem. I went to some trouble to not use it as you will see below.
But I might try adding it back for this user and see if it helps.
It is a media player, and there are short pauses in some areas, such as to wait for the player process to come back from executing a command before executing another one.
The player itself is a separate process controlled by this one using shared memory.
The sleep is in a procedure which loops around for a set period (100ms in this case) with a sleep(5) and a MainForm.Update so VU meters continue moving.
From: delphi-bounces@list... [mailto:delphi-bounces@list...] ! On Behalf Of Pieter De Wit
Sent: Monday, 14 May 2012 9:47 p.m.
To: NZ Borland Developers Group - Delphi List; 'NZ Borland Developers Group - Delphi List'
Subject: Re: [DUG] Hang during Sleep