<br><br><div class="gmail_quote">2011/8/15 Michael Schnell <span dir="ltr"><<a href="mailto:mschnell@lumino.de">mschnell@lumino.de</a>></span><br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<div class="im">On 08/15/2011 02:21 PM, Juan Sánchez wrote:<br>
</div><div class="im"><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
. I've discovered a simple method that seems to run ok on both Win and<br>
Mac.<br>
</blockquote></div><div class="im">
You don't create the application instance but you initialize it.<br>
<br>
Seemingly this does not harm the Application instance of the main executable. So it seems like the DLL automatically instantiates it's own independent Application instance (and has its own "Application" variable to manage same).<br>
<br></div></blockquote><div><br>Exact. I was surprising about what DLL does. I think as you. It seem that DLL instantiates it's own independent Application instance, but I did't expect this would work. I discovered that in Mac it's not necessary to initialize Application instance in DLL. In fact, InitAppDLL and TermAppDll are not necessaries in Mac, only in Windows. <br>
</div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"><div>
This in fact is possible. You might want to verify this by printing both the Application pointers via IntToHex(integer(Application)), 8) ) and verify that they are different.<br>
<br></div></blockquote><div><br>Ok. I'll do it.<br> </div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"><div>
As you don't use a thread, I suppose Application.Initialize in the DLL re-attaches the GUI framework to the main thread. I suppose this will freeze or destroy the GUI of the main program. This might or might not be desirable. I think it is not desirable, as e.g. TTimers are handled via the GUI binding.<br>
<br><br></div></blockquote><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"><div class="im">
You might want to check if the GUI and/or the TTimers of the main program are still workable wile/after the DLL's GUI is displayed.<br>
<br></div></blockquote><div><br><br>
In main program simple controls as edit and buttons work ok. I'll test about TTimers and other controls. Only thing I've seen until now is that when a message is displayed from dll form, in Windows I get an error closing main windows if dll form is visible with this message box. In Mac this is not so because a message box from dll make all forms disabled until you close this modal message window.<br>
</div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"><div class="im"></div><div><div></div><div class="h5">
-Michael<br>
<br>
<br>
<br>
<br>
<br>
--<br>
______________________________<u></u>_________________<br>
Lazarus mailing list<br>
<a href="mailto:Lazarus@lists.lazarus.freepascal.org" target="_blank">Lazarus@lists.lazarus.<u></u>freepascal.org</a><br>
<a href="http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus" target="_blank">http://lists.lazarus.<u></u>freepascal.org/mailman/<u></u>listinfo/lazarus</a><br>
</div></div></blockquote></div><br>