[DUG] Why does this hang?
Jolyon Smith
jsmith at deltics.co.nz
Mon Aug 1 21:33:39 NZST 2011
Yep, critical to this is not what happens to the matching messages but what is being done (or not) with messages that don't match.
I would expect to see an 'else' which repeats the call to PeekMessage but without the PM_REMOVE flag.
Edward Huang <edwardh at slingshot.co.nz> wrote:
Not 100% sure, but I thought that your loop will not work if the message on top of the queue is not falling into your range, and the message would remain on the queue (due to 'NOREMOVE' flag), and will be peeked everytime afterwards.
Not sure which message MadExcept uses, it could well be outside of your message ID range.
Edward
From: delphi-bounces at delphi.org.nz [mailto:delphi-bounces at delphi.org.nz] On Behalf Of Ross Levis
Sent: Thursday, 28 July 2011 11:17 p.m.
To: 'NZ Borland Developers Group - Delphi List'
Subject: Re: [DUG] Why does this hang?
A little more info. I have MadExcept operating and it detected “The application seems to be frozen.”
77fa15ec ntdll.dll KiUserCallbackDispatcher
77e1567d user32.dll PeekMessageA
KiUserCallbackDispatcher is where it is hanging.
From: delphi-bounces at delphi.org.nz [mailto:delphi-bounces at delphi.org.nz] On Behalf Of Ross Levis
Sent: Thursday, 28 July 2011 11:09 p.m.
To: 'NZ Borland Developers Group - Delphi List'
Subject: [DUG] Why does this hang?
I’m using the following code inside a wait loop so that most messages are processed except for some mouse and keyboard messages (I think) which I don’t want to be processed. It’s working perfectly here but for another user it hangs indefinitely.
If PeekMessage(Msg, MainForm.Handle , 0, 0, PM_NOREMOVE) and
((Msg.message < 160) or ((Msg.message > 264) and (Msg.message < 512))
or (Msg.message > 524)) then
Application.HandleMessage;
I use to have an Application.ProcessMessages but this was causing a problem which I can’t remember now, and this code fixed it.
Cheers.
No virus found in this message.
Checked by AVG - www.avg.com
Version: 10.0.1390 / Virus Database: 1518/3797 - Release Date: 07/29/11
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://listserver.123.net.nz/pipermail/delphi/attachments/20110801/c323e5f0/attachment-0001.html
More information about the Delphi
mailing list