Lazarus

Programming => LCL => Topic started by: regubed on March 08, 2021, 07:29:24 am

Title: form in dll ,form cant contain any ctrl ,button,edit,listview ...,
Post by: regubed on March 08, 2021, 07:29:24 am
form in dll ,form cant contain any ctrl ,button,edit,listview ...,
even if a button ,when inject dll ,the application crash,
try exception  no use ....what can i do ,thank u
Title: Re: form in dll ,form cant contain any ctrl ,button,edit,listview ...,
Post by: MarkMLl on March 08, 2021, 09:47:07 am
Short answer: correct.

Longer answer: https://wiki.freepascal.org/Form_in_DLL

This is a well-documented and well-understood limitation. What I've done in the past is used a form in a shared-object file (the unix analogue of a DLL) to build up menus etc., and then copied them to the main form at runtime.

MarkMLl
Title: Re: form in dll ,form cant contain any ctrl ,button,edit,listview ...,
Post by: balazsszekely on March 08, 2021, 06:09:38 pm
Tested the attached application with:
 - Lazarus 2.0.12/Trunk and FPC 3.2.0
 - Windows 10, Linux Mint 19.2 Cinnamon, macOS 10.16 Big Sur
Please do the following:
1. Open then build plugin.lpi from pluginlibrary subfolder. This is the library(dll, so, dylib), it contains form, buttons, images, etc...
2. Open test.lpi, build then run the project. When you press the "Load" button, the form from the library is loaded then embedded in the main form.

Is this what are you after?
Title: Re: form in dll ,form cant contain any ctrl ,button,edit,listview ...,
Post by: alaa123456789 on March 09, 2021, 06:39:05 pm
Tested the attached application with:
 - Lazarus 2.0.12/Trunk and FPC 3.2.0
 - Windows 10, Linux Mint 19.2 Cinnamon, macOS 10.16 Big Sur
Please do the following:
1. Open then build plugin.lpi from pluginlibrary subfolder. This is the library(dll, so, dylib), it contains form, buttons, images, etc...
2. Open test.lpi, build then run the project. When you press the "Load" button, the form from the library is loaded then embedded in the main form.

Is this what are you after?
very nice example ,thank you ,when i press x button we got this (attached)
thanks
Title: Re: form in dll ,form cant contain any ctrl ,button,edit,listview ...,
Post by: balazsszekely on March 09, 2021, 06:44:38 pm
@alaa123456789
Quote
when i press x button we got this (attached)
The dialog is just a quick check for memory leaks. You can remove it by unchecking the checkbox in the project options.
TinyPortal © 2005-2018