Recent

Author Topic: form in dll ,form cant contain any ctrl ,button,edit,listview ...,  (Read 2811 times)

regubed

  • Newbie
  • Posts: 1
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

MarkMLl

  • Hero Member
  • *****
  • Posts: 6676
Re: form in dll ,form cant contain any ctrl ,button,edit,listview ...,
« Reply #1 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
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

balazsszekely

  • Guest
Re: form in dll ,form cant contain any ctrl ,button,edit,listview ...,
« Reply #2 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?

alaa123456789

  • Sr. Member
  • ****
  • Posts: 260
  • Try your Best to learn & help others
    • youtube:
Re: form in dll ,form cant contain any ctrl ,button,edit,listview ...,
« Reply #3 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

balazsszekely

  • Guest
Re: form in dll ,form cant contain any ctrl ,button,edit,listview ...,
« Reply #4 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