[Lazarus] RE : Forms in DLL

Juan Sánchez aldeacity at gmail.com
Mon Aug 15 15:27:41 CEST 2011


2011/8/15 Michael Schnell <mschnell at lumino.de>

> On 08/15/2011 02:21 PM, Juan Sánchez wrote:
>
>> . I've discovered a simple method that seems to run ok on both Win and
>> Mac.
>>
> You don't create the application instance but you initialize it.
>
> 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).
>
>
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.


> 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.
>
>
Ok. I'll do it.


> 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.
>
>
> 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.
>
>

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.


> -Michael
>
>
>
>
>
> --
> ______________________________**_________________
> Lazarus mailing list
> Lazarus at lists.lazarus.**freepascal.org<Lazarus at lists.lazarus.freepascal.org>
> http://lists.lazarus.**freepascal.org/mailman/**listinfo/lazarus<http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20110815/da8dfd26/attachment-0003.html>


More information about the Lazarus mailing list