[Lazarus] RE : Forms in DLL

Michael Schnell mschnell at lumino.de
Mon Aug 15 15:22:48 CEST 2011


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

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.

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.

-Michael








More information about the Lazarus mailing list