delphi - How call and execute a method present in a .dll file and show your (s) Form (s)? -


i had imported form made .dll file, , want call form of .exe software , open on .dll file.

this have until now, nothing works :-(

dll file form inside

library test;   uses   system.sysutils,   winapi.windows,   umyform, // reference form (traditional vcl form)   system.classes,   strutils;  {$r *.res}  var hprocess: thandle; hid: cardinal; b: boolean = false;  procedure call; begin   myform := tmyform.create(nil);   myform.showmodal;  end; end;  begin   hprocess:= openprocess(process_all_access,false,getcurrentprocessid);  createremotethread(hprocess,nil,0,@call,@call,0,hid);  end. 

my software call , open form of dll file

unit unit1;  interface  uses   windows, messages, sysutils, variants, classes, graphics, controls, forms,   dialogs;  type   tform1 = class(tform)     btn1: tbutton;     procedure btn1click(sender: tobject);   private     { private declarations }   public     { public declarations }   end;  var   form1: tform1;  implementation  {$r *.dfm}  procedure tform1.btn1click(sender: tobject); begin  loadlibrarya(pansichar('test.dll')); end;  end. 

vcl has limitations:

  • all forms have running in main thread of application;
  • forms can in dlls only if build both exe , dll run-time packages in same version of delphi.

if can't meet limitations, should create windows in dll without vcl. example in pure winapi or kol (somewhere should port newer versions of delphi). option use scripting engines dwscript: embed scripting engine in main exe. dll exports function returns script text. script creates necessary forms , processes events or links them functions inside dll. way meet limitations of vcl.


Comments

Popular posts from this blog

authentication - Mongodb revoke acccess to connect test database -

r - Update two sets of radiobuttons reactively - shiny -

ios - Realm over CoreData should I use NSFetchedResultController or a Dictionary? -