Lazarus
Programming => LCL => Topic started 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
-
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
-
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?
-
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
-
@alaa123456789
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.