<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"></head><body><span class="Apple-style-span" style="background-color: transparent;">Yep, <span class="Apple-style-span" style="background-color: transparent;">critical <span class="Apple-style-span" style="background-color: transparent;">to <span class="Apple-style-span" style="background-color: transparent;">this <span class="Apple-style-span" style="background-color: transparent;">is <span class="Apple-style-span" style="background-color: transparent;">not <span class="Apple-style-span" style="background-color: transparent;">what <span class="Apple-style-span" style="background-color: transparent;">happens <span class="Apple-style-span" style="background-color: transparent;">to <span class="Apple-style-span" style="background-color: transparent;">the <span class="Apple-style-span" style="background-color: transparent;">matching <span class="Apple-style-span" style="background-color: transparent;">messages <span class="Apple-style-span" style="background-color: transparent;">but <span class="Apple-style-span" style="background-color: transparent;">what <span class="Apple-style-span" style="background-color: transparent;">is <span class="Apple-style-span" style="background-color: transparent;">being <span class="Apple-style-span" style="background-color: transparent;">done (<span class="Apple-style-span" style="background-color: transparent;">or <span class="Apple-style-span" style="background-color: transparent;">not) <span class="Apple-style-span" style="background-color: transparent;">with <span class="Apple-style-span" style="background-color: transparent;">messages <span class="Apple-style-span" style="background-color: transparent;">that <span class="Apple-style-span" style="background-color: transparent;">don't <span class="Apple-style-span" style="background-color: transparent;">match.</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span><div><span class="Apple-style-span" style="background-color: transparent;"><span class="Apple-style-span" style="background-color: transparent;"><span class="Apple-style-span" style="background-color: transparent;"><span class="Apple-style-span" style="background-color: transparent;"><span class="Apple-style-span" style="background-color: transparent;"><span class="Apple-style-span" style="background-color: transparent;"><span class="Apple-style-span" style="background-color: transparent;"><span class="Apple-style-span" style="background-color: transparent;"><span class="Apple-style-span" style="background-color: transparent;"><span class="Apple-style-span" style="background-color: transparent;"><span class="Apple-style-span" style="background-color: transparent;"><span class="Apple-style-span" style="background-color: transparent;"><span class="Apple-style-span" style="background-color: transparent;"><span class="Apple-style-span" style="background-color: transparent;"><span class="Apple-style-span" style="background-color: transparent;"><span class="Apple-style-span" style="background-color: transparent;"><span class="Apple-style-span" style="background-color: transparent;"><span class="Apple-style-span" style="background-color: transparent;"><span class="Apple-style-span" style="background-color: transparent;"><span class="Apple-style-span" style="background-color: transparent;"><span class="Apple-style-span" style="background-color: transparent;"><span class="Apple-style-span" style="background-color: transparent;"><span class="Apple-style-span" style="background-color: transparent;"><span class="Apple-style-span" style="background-color: transparent;"><br></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></div><div><span class="Apple-style-span" style="background-color: transparent;">I <span class="Apple-style-span" style="background-color: transparent;">would <span class="Apple-style-span" style="background-color: transparent;">expect <span class="Apple-style-span" style="background-color: transparent;">to <span class="Apple-style-span" style="background-color: transparent;">se<span class="Apple-style-span" style="background-color: transparent;">e <span class="Apple-style-span" style="background-color: transparent;">an '<span class="Apple-style-span" style="background-color: transparent;">else' <span class="Apple-style-span" style="background-color: transparent;">which <span class="Apple-style-span" style="background-color: transparent;">repeats <span class="Apple-style-span" style="background-color: transparent;">the <span class="Apple-style-span" style="background-color: transparent;">call <span class="Apple-style-span" style="background-color: transparent;">to <span class="Apple-style-span" style="background-color: transparent;">PeekMessage <span class="Apple-style-span" style="background-color: transparent;">but <span class="Apple-style-span" style="background-color: transparent;">without <span class="Apple-style-span" style="background-color: transparent;">the <span class="Apple-style-span" style="background-color: transparent;">PM_<span class="Apple-style-span" style="background-color: transparent;">REMOVE <span class="Apple-style-span" style="background-color: transparent;">flag.</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></div><br><br><br> Edward Huang &lt;edwardh@slingshot.co.nz&gt; wrote: <br><br><br>
<div dir="ltr" align="left"><span class="391164808-01082011"><font color="#0000ff" size="2" face="Arial">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.</font></span></div>
<div dir="ltr" align="left"><span class="391164808-01082011"><font color="#0000ff" size="2" face="Arial"></font></span>&nbsp;</div>
<div dir="ltr" align="left"><span class="391164808-01082011"><font color="#0000ff" size="2" face="Arial">Not sure which message MadExcept uses, it could well be 
outside of your message ID range.</font></span></div>
<div dir="ltr" align="left"><span class="391164808-01082011"><font color="#0000ff" size="2" face="Arial"></font></span>&nbsp;</div>
<div dir="ltr" align="left"><span class="391164808-01082011"><font color="#0000ff" size="2" face="Arial">Edward</font></span></div><br>
<div dir="ltr" lang="en-us" class="OutlookMessageHeader" align="left">
<hr tabindex="-1">
<font face="Tahoma"><font size="2"><b>From:</b> delphi-bounces@delphi.org.nz 
[mailto:delphi-bounces@delphi.org.nz] <b>On Behalf Of </b>Ross 
Levis<br><b>Sent:</b> Thursday, 28 July 2011 11:17 p.m.<br><b>To:</b> 'NZ 
Borland Developers Group - Delphi List'<br><b>Subject:</b> Re: [DUG] Why does 
this hang?<br></font></font><br></div>
<div></div>
<div class="WordSection1">
<p class="MsoNormal"><span style="COLOR: #1f497d; FONT-SIZE: 12pt">A little more 
info.&nbsp; I have MadExcept operating and it detected “The application seems to 
be frozen.”<o:p></o:p></span></p>
<p class="MsoNormal"><span style="COLOR: #1f497d; FONT-SIZE: 12pt"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal"><span style="COLOR: #1f497d; FONT-SIZE: 12pt">77fa15ec 
ntdll.dll&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
KiUserCallbackDispatcher<o:p></o:p></span></p>
<p class="MsoNormal"><span style="COLOR: #1f497d; FONT-SIZE: 12pt">77e1567d 
user32.dll&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
PeekMessageA<o:p></o:p></span></p>
<p class="MsoNormal"><span style="COLOR: #1f497d; FONT-SIZE: 12pt"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal"><span style="COLOR: #1f497d; FONT-SIZE: 12pt">KiUserCallbackDispatcher is where it is 
hanging.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="COLOR: #1f497d; FONT-SIZE: 12pt"><o:p>&nbsp;</o:p></span></p>
<div>
<div style="BORDER-BOTTOM: medium none; BORDER-LEFT: medium none; PADDING-BOTTOM: 0cm; PADDING-LEFT: 0cm; PADDING-RIGHT: 0cm; BORDER-TOP: #b5c4df 1pt solid; BORDER-RIGHT: medium none; PADDING-TOP: 3pt">
<p class="MsoNormal"><b><span style="FONT-FAMILY: 'Tahoma','sans-serif'; FONT-SIZE: 10pt" lang="EN-US">From:</span></b><span style="FONT-FAMILY: 'Tahoma','sans-serif'; FONT-SIZE: 10pt" lang="EN-US"> 
delphi-bounces@delphi.org.nz [mailto:delphi-bounces@delphi.org.nz] <b>On Behalf 
Of </b>Ross Levis<br><b>Sent:</b> Thursday, 28 July 2011 11:09 
p.m.<br><b>To:</b> 'NZ Borland Developers Group - Delphi 
List'<br><b>Subject:</b> [DUG] Why does this 
hang?<o:p></o:p></span></p></div></div>
<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
<p class="MsoNormal"><span style="COLOR: #1f497d; FONT-SIZE: 12pt">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.&nbsp; It’s working perfectly here but for another user it hangs 
indefinitely.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="COLOR: #1f497d; FONT-SIZE: 12pt"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal"><span style="COLOR: #1f497d; FONT-SIZE: 12pt">If 
PeekMessage(Msg, MainForm.Handle , 0, 0, PM_NOREMOVE) and<o:p></o:p></span></p>
<p class="MsoNormal"><span style="COLOR: #1f497d; FONT-SIZE: 12pt">((Msg.message 
&lt; 160) or ((Msg.message &gt; 264) and (Msg.message &lt; 
512))<o:p></o:p></span></p>
<p class="MsoNormal"><span style="COLOR: #1f497d; FONT-SIZE: 12pt">or (Msg.message 
&gt; 524)) then<o:p></o:p></span></p>
<p class="MsoNormal"><span style="COLOR: #1f497d; FONT-SIZE: 12pt">&nbsp;&nbsp; 
Application.HandleMessage;<o:p></o:p></span></p>
<p class="MsoNormal"><span style="COLOR: #1f497d; FONT-SIZE: 12pt"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal"><span style="COLOR: #1f497d; FONT-SIZE: 12pt">I use to have 
an Application.ProcessMessages but this was causing a problem which I can’t 
remember now, and this code fixed it.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="COLOR: #1f497d; FONT-SIZE: 12pt"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal"><span style="COLOR: #1f497d; FONT-SIZE: 12pt">Cheers.<o:p></o:p></span></p></div>
<hr size="1" noshade="">
<a></a>
<p class="avgcert" align="left" color="#000000">No virus found in this 
message.<br>Checked by AVG - <a href="http://www.avg.com/">www.avg.com</a><br>Version: 10.0.1390 / Virus 
Database: 1518/3797 - Release Date: 07/29/11</p> </body>