<html><head>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
</head><body bgcolor="#FFFFFF" text="#000000">Weird. It could be that
the DLL is trying to do it's work on a thread but is using the same
thread for it's actual work and for responding to messages or it may be
creating separate threads but have synchronization that causes them to
block each other. As I say, without source it's pretty much impossible
to say for certain, though keeping an eye on the IDE thread-list window
in the debugger might shed some light.<br>
<br>
Good luck. :)<br>
<blockquote style="border: 0px none;"
cite="mid:00c601ced50f$fc74c5a0$f55e50e0$@com" type="cite">
<div style="margin:30px 25px 10px 25px;" class="__pbConvHr"><div
style="display:table;width:100%;border-top:1px solid
#EDEEF0;padding-top:5px">         <div
style="display:table-cell;vertical-align:middle;padding-right:6px;"><img
photoaddress="ross@stationplaylist.com" photoname="Ross Levis"
src="cid:part1.05040400.06000802@deltics.co.nz"
name="compose-unknown-contact.jpg" height="25px" width="25px"></div> <div
style="display:table-cell;white-space:nowrap;vertical-align:middle;width:100%">
        <a moz-do-not-send="true" href="mailto:ross@stationplaylist.com"
style="color:#737F92
!important;padding-right:6px;font-weight:bold;text-decoration:none
!important;">Ross Levis</a></div> <div
style="display:table-cell;white-space:nowrap;vertical-align:middle;">
<font color="#9FA2A5"><span style="padding-left:6px">Wed, 30 Oct 2013
14:33</span></font></div></div></div>
<div style="color:#888888;margin-left:24px;margin-right:24px;"
__pbrmquotes="true" class="__pbConvBody"><meta content="text/html;
charset=UTF-8" http-equiv="Content-Type"><meta content="Microsoft Word
12 (filtered medium)" name="Generator"><style><!--
/* Font Definitions */
@font-face
        {font-family:SimSun;
        panose-1:2 1 6 0 3 1 1 1 1 1;}
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
        {font-family:"\@SimSun";
        panose-1:2 1 6 0 3 1 1 1 1 1;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--><div class="WordSection1"><p
class="MsoNormal"><span
style="font-family:"Calibri","sans-serif";color:#1F497D">Except
that I can disable the ProcessMessage code and the DLL still functions
correctly. It was added only to resolve the component focus issue.
Without it you couldn’t see which component on the GUI had the focus
when tabbing. So I think it may be the DLL simply occupying the main
thread when it starts its work, and I was wrong thinking the messages
had something to do with it.<o:p></o:p></span></p><p class="MsoNormal"><span
style="font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p><p
class="MsoNormal"><span
style="font-family:"Calibri","sans-serif";color:#1F497D">Cheers.<o:p></o:p></span></p><p
class="MsoNormal"><span
style="font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p><div
style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm
0cm"><p class="MsoNormal"><b><span
style="font-size:10.0pt;font-family:"Tahoma","sans-serif""
lang="EN-US">From:</span></b><span
style="font-size:10.0pt;font-family:"Tahoma","sans-serif""
lang="EN-US"> <a class="moz-txt-link-abbreviated" href="mailto:delphi-bounces@listserver.123.net.nz">delphi-bounces@listserver.123.net.nz</a>
[<a class="moz-txt-link-freetext" href="mailto:delphi-bounces@listserver.123.net.nz">mailto:delphi-bounces@listserver.123.net.nz</a>] <b>On Behalf Of </b>Jolyon
Smith<br><b>Sent:</b> Wednesday, 30 October 2013 8:47 a.m.<br><b>To:</b>
NZ Borland Developers Group - Delphi List<br><b>Subject:</b> Re: [DUG]
Applicarion.ProcessMessage<o:p></o:p></span></p></div><p
class="MsoNormal"><o:p> </o:p></p><div><p class="MsoNormal">It is both.
:) <o:p></o:p></p></div><div><p class="MsoNormal"><o:p> </o:p></p></div><div><p
class="MsoNormal">The processing of any message on the message queue
consumes the thread pumping that message queue.<o:p></o:p></p></div><div><p
class="MsoNormal"><o:p> </o:p></p></div><div><p class="MsoNormal">The
DLL is consuming messages from your message queue but instead of
responding to an appropriate message by spawning a separate thread to do
the work it requires, it sounds like it is performing that work on the
message thread. The net effect is that your message thread is not
“stuck” or “hung” but merely very, very busy, doing the work that the
DLL is asking of it.<o:p></o:p></p></div><div><p class="MsoNormal"><o:p> </o:p></p></div><div><p
class="MsoNormal"><b>ProcessMessage</b> isn’t “hanging”. it’s just
doing what it’s been asked to do - processing the message. :)<o:p></o:p></p></div><div><p
class="MsoNormal"><o:p> </o:p></p></div><div><p class="MsoNormal">It’s
no different than if the server request that the DLL is performing were
instead part of an <b>OnClick</b> event on a button in your own app.
The app would “freeze” until the server request has complete. The only
difference here is that the “event handler” is somewhere in side that
DLL.<o:p></o:p></p></div><div><p class="MsoNormal"><o:p> </o:p></p></div><div><p
class="MsoNormal"><o:p> </o:p></p></div><div><p class="MsoNormal">This
is precisely why event response code should always be as efficient as
possible. Ideally you would do <b>all</b> your application work in a
separate thread and leave the main thread to be <b>solely</b>
responsible for pumping the message queue. But even then, if you
voluntarily offer up control of your message queue thread to an outside
DLL, there is always the risk that they will “abuse" the privilege, as
appears to be happening in this case.<o:p></o:p></p></div><div><p
class="MsoNormal"><o:p> </o:p></p></div><div><div><p class="MsoNormal">-- <o:p></o:p></p></div><div><p
class="MsoNormal">Jolyon Smith<o:p></o:p></p></div></div></div><div>_______________________________________________<br>NZ
Borland Developers Group - Delphi mailing list<br>Post:
<a class="moz-txt-link-abbreviated" href="mailto:delphi@listserver.123.net.nz">delphi@listserver.123.net.nz</a><br>Admin:
<a class="moz-txt-link-freetext" href="http://delphi.org.nz/mailman/listinfo/delphi">http://delphi.org.nz/mailman/listinfo/delphi</a><br>Unsubscribe: send an
email to <a class="moz-txt-link-abbreviated" href="mailto:delphi-request@listserver.123.net.nz">delphi-request@listserver.123.net.nz</a> with Subject: unsubscribe</div></div>
<div style="margin:30px 25px 10px 25px;" class="__pbConvHr"><div
style="display:table;width:100%;border-top:1px solid
#EDEEF0;padding-top:5px">         <div
style="display:table-cell;vertical-align:middle;padding-right:6px;"><img
photoaddress="jsmith@deltics.co.nz" photoname="Jolyon Smith"
src="cid:part2.01090702.07040901@deltics.co.nz"
name="postbox-contact.jpg" height="25px" width="25px"></div> <div
style="display:table-cell;white-space:nowrap;vertical-align:middle;width:100%">
        <a moz-do-not-send="true" href="mailto:jsmith@deltics.co.nz"
style="color:#737F92
!important;padding-right:6px;font-weight:bold;text-decoration:none
!important;">Jolyon Smith</a></div> <div
style="display:table-cell;white-space:nowrap;vertical-align:middle;">
<font color="#9FA2A5"><span style="padding-left:6px">Wed, 30 Oct 2013
08:46</span></font></div></div></div>
<div style="color:#888888;margin-left:24px;margin-right:24px;"
__pbrmquotes="true" class="__pbConvBody">
<div>
It is both. :)
</div><div><br></div><div>The processing of any message
on the message queue consumes the thread pumping that message queue.</div><div><br></div><div>The
DLL is consuming messages from your message queue but instead of
responding to an appropriate message by spawning a separate thread to do
the work it requires, it sounds like it is performing that work on the
message thread. The net effect is that your message thread is not
“stuck” or “hung” but merely very, very busy, doing the work that the
DLL is asking of it.</div><div><br></div><div><b>ProcessMessage</b>
isn’t “hanging”. it’s just doing what it’s been asked to do -
processing the message. :)</div><div><br></div><div>It’s no different
than if the server request that the DLL is performing were instead part
of an <b>OnClick</b> event on a button in your own app. The app would
“freeze” until the server request has complete. The only difference
here is that the “event handler” is somewhere in side that DLL.</div><div><br></div><div><br></div><div>This
is precisely why event response code should always be as efficient as
possible. Ideally you would do <b>all</b> your application work in a
separate thread and leave the main thread to be <b>solely</b>
responsible for pumping the message queue. But even then, if you
voluntarily offer up control of your message queue thread to an outside
DLL, there is always the risk that they will “abuse" the privilege, as
appears to be happening in this case.</div><div><br></div><div><div>-- </div><div>Jolyon
Smith</div></div>
</div>
<div style="margin:30px 25px 10px 25px;" class="__pbConvHr"><div
style="display:table;width:100%;border-top:1px solid
#EDEEF0;padding-top:5px">         <div
style="display:table-cell;vertical-align:middle;padding-right:6px;"><img
photoaddress="ross@stationplaylist.com" photoname="Ross Levis"
src="cid:part1.05040400.06000802@deltics.co.nz"
name="compose-unknown-contact.jpg" height="25px" width="25px"></div> <div
style="display:table-cell;white-space:nowrap;vertical-align:middle;width:100%">
        <a moz-do-not-send="true" href="mailto:ross@stationplaylist.com"
style="color:#737F92
!important;padding-right:6px;font-weight:bold;text-decoration:none
!important;">Ross Levis</a></div> <div
style="display:table-cell;white-space:nowrap;vertical-align:middle;">
<font color="#9FA2A5"><span style="padding-left:6px">Wed, 30 Oct 2013
03:51</span></font></div></div></div>
<div style="color:#888888;margin-left:24px;margin-right:24px;"
__pbrmquotes="true" class="__pbConvBody"><meta content="text/html;
charset=UTF-8" http-equiv="Content-Type"><meta content="Microsoft Word
12 (filtered medium)" name="Generator"><style><!--
/* Font Definitions */
@font-face
        {font-family:SimSun;
        panose-1:2 1 6 0 3 1 1 1 1 1;}
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
        {font-family:"\@SimSun";
        panose-1:2 1 6 0 3 1 1 1 1 1;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p
        {mso-style-priority:99;
        mso-margin-top-alt:auto;
        margin-right:0cm;
        mso-margin-bottom-alt:auto;
        margin-left:0cm;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
p.MsoAcetate, li.MsoAcetate, div.MsoAcetate
        {mso-style-priority:99;
        mso-style-link:"Balloon Text Char";
        margin:0cm;
        margin-bottom:.0001pt;
        font-size:8.0pt;
        font-family:"Tahoma","sans-serif";}
span.EmailStyle18
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
span.BalloonTextChar
        {mso-style-name:"Balloon Text Char";
        mso-style-priority:99;
        mso-style-link:"Balloon Text";
        font-family:"Tahoma","sans-serif";}
.MsoChpDefault
        {mso-style-type:export-only;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--><div class="WordSection1"><p
class="MsoNormal"><span
style="font-family:"Calibri","sans-serif";color:#1F497D">Ok.
I thought it might be the ProcessMessage function that was hanging, but
perhaps it is simply the main thread stuck in the DLL and nothing to do
with the message processing.<o:p></o:p></span></p><p class="MsoNormal"><span
style="font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p><p
class="MsoNormal"><span
style="font-family:"Calibri","sans-serif";color:#1F497D">Thanks.<o:p></o:p></span></p><p
class="MsoNormal"><span
style="font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p><div
style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm
0cm"><p class="MsoNormal"><b><span
style="font-size:10.0pt;font-family:"Tahoma","sans-serif""
lang="EN-US">From:</span></b><span
style="font-size:10.0pt;font-family:"Tahoma","sans-serif""
lang="EN-US"> <a class="moz-txt-link-abbreviated" href="mailto:delphi-bounces@listserver.123.net.nz">delphi-bounces@listserver.123.net.nz</a>
[<a class="moz-txt-link-freetext" href="mailto:delphi-bounces@listserver.123.net.nz">mailto:delphi-bounces@listserver.123.net.nz</a>] <b>On Behalf Of </b>Jolyon
Smith<br><b>Sent:</b> Tuesday, 29 October 2013 8:41 p.m.<br><b>To:</b>
NZ Borland Developers Group - Delphi List<br><b>Subject:</b> Re: [DUG]
Applicarion.ProcessMessage<o:p></o:p></span></p></div><p
class="MsoNormal"><o:p> </o:p></p><div><p class="MsoNormal">If I have
understood correctly and the DLL polling is occurring on the main thread
then you don’t have the option of changing ProcessMessage once the
message that triggers the DLL processing has been dispatched. As soon as
that message is processed, causing the DLL to go off and do it’s thing,
your VCL thread is already committed to servicing that DLL. <o:p></o:p></p></div><div><div><p
class="MsoNormal"><o:p> </o:p></p></div><div><p class="MsoNormal">-- <o:p></o:p></p></div><div><p
class="MsoNormal">Jolyon Smith<o:p></o:p></p></div><div><p
class="MsoNormal"><o:p> </o:p></p></div></div><p><span
style="color:#A0A0A8">On Tuesday, 29 October 2013 at 19:54 , Ross Levis
wrote:<o:p></o:p></span></p><div><p class="MsoNormal"><o:p> </o:p></p></div></div><div>_______________________________________________<br>NZ
Borland Developers Group - Delphi mailing list<br>Post:
<a class="moz-txt-link-abbreviated" href="mailto:delphi@listserver.123.net.nz">delphi@listserver.123.net.nz</a><br>Admin:
<a class="moz-txt-link-freetext" href="http://delphi.org.nz/mailman/listinfo/delphi">http://delphi.org.nz/mailman/listinfo/delphi</a><br>Unsubscribe: send an
email to <a class="moz-txt-link-abbreviated" href="mailto:delphi-request@listserver.123.net.nz">delphi-request@listserver.123.net.nz</a> with Subject: unsubscribe</div></div>
</blockquote>
</body></html>