Hm, I forgot about <meta http-equiv="content-type" content="text/html; charset=utf-8">Application.QueueAsyncCall. And this can be safely call from thread without TThread.Synchronize() ? Because I don't want use Synchronize() in any part of thread code. So this is correct code? :<div>
<br></div><div>procedure TMyThread.Execute;</div><div>begin</div><div> // <some code here></div><div> Application.QueueAsyncCall(@SomeObj.TestMethod, PtrInt(NewStr('Some value')));</div><meta http-equiv="content-type" content="text/html; charset=utf-8"><div>
// <some code here></div><div>end;</div><div><br></div><div>There is no chance for deadlock with main thread calling this from inside another thread? </div><div>But can be problem here if thread try call "<meta http-equiv="content-type" content="text/html; charset=utf-8">Application.QueueAsyncCall" for object which was freed (AV occur). PostMessage just return false if handle doesn't exists.<br>
<br><div class="gmail_quote">2011/6/8 Michael Schnell <span dir="ltr"><<a href="mailto:mschnell@lumino.de">mschnell@lumino.de</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div class="im">On 06/08/2011 04:57 PM, Krzysztof wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
How can I PostMessage from thread to another object?<br>
</blockquote></div>
While "PostMessage()" and "Procedure...Message" is available with Lazarus, you better use the non-Windowish Application.QueueAsyncCall() procedure.<br>
<br>
BTW.: with Delphi, you mostly better user TThread.Queue for this purpose.<br>
<br>
-Michael<br><font color="#888888">
<br>
--<br>
_______________________________________________<br>
Lazarus mailing list<br>
<a href="mailto:Lazarus@lists.lazarus.freepascal.org" target="_blank">Lazarus@lists.lazarus.freepascal.org</a><br>
<a href="http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus" target="_blank">http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus</a><br>
<br>
</font></blockquote></div><br></div>