Jump to content


Photo

unimForm in external dll

unimForm dll

  • Please log in to reply
No replies to this topic

#1 luca71

luca71

    Newbie

  • uniGUI Subscriber
  • Pip
  • 1 posts

Posted 12 November 2017 - 09:11 AM

Hi,

I'd like to call from a UniMobileApplication a UnimForm inserted in a DLL
but, when I call it, I receive this error message:

 

"Form Owner must be UniApplication"

 

Someone can help me?

​Thanks.

 

 

 

Example
*****************************************
**  MyMobileApplication.exe 
*****************************************
program ApplicationServer;
uses
  Forms,
  ServerModule in 'ServerModule.pas' {UniServerModule: TUniGUIServerModule},
  MainModule in 'MainModule.pas' {UniMainModule: TUniGUIMainModule},
  Mainm in 'Mainm.pas' {MainmForm: TUnimForm},

{$R *.res}
 
begin
  ReportMemoryLeaksOnShutdown := True;
  Application.Initialize;
  TUniServerModule.Create(Application);
  Application.Run;
end.
 
unit Mainm;
type
  TMainmForm = class(TUnimForm)
    UnimBitBtn1: TUnimBitBtn;
  private
    { Private declarations }
  public
    { Public declarations }
  end;

function my_external_form ( UniApplication: TUniGUIApplication ): TUnimForm; StdCall ; external "c:\temp\my_dll.dll" ;

implementation
..
..
..
procedure TMainmForm.UnimBitBtn1Click(Sender: TObject);
begin
  result := my_externat_form ( UniApplication ) ;
end;
 
*******************************
** c:\temp\my_dll.dll  **
*******************************
library My_dll;
uses
  Mobile_form in 'Mobile_form.pas' {UnimForm1: TUnimForm};
{$R *.res}
exports
   my_external_form ;
begin
end.

************************************
unit Mobile_form;
interface
uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics,
  uniGUIServer, uniGUIMainModule, uniGUIApplication, uIdCustomHTTPServer,
  uniGUITypes,
  Controls, uniGUIAbstractClasses,
  uniGUIClasses, uniGUImClasses, uniGUIForm, uniGUImForm, uniGUImJSForm ;

type
  TUnimForm1 = class(TUnimForm)
  private
    { Private declarations }
  public
    { Public declarations }
  end;
 
Var MyUniApplication :TUniGUIApplication ;
 
function my_external_form ( UniApplication :TUniGUIApplication ) :TUnimForm ; stdCall ;
function UnimForm1: TUnimForm1;
 
implementation
 
{$R *.dfm}

function my_external_form( UniApplication :TUniGUIApplication ):TUnimForm ;
Begin
  MyUniApplication := UniApplication ;
  Result := UnimForm1 ;
End;
 
function UnimForm1: TUnimForm1;
begin
  Result := TUnimForm1 ( MyUniApplication.UniMainModule.GetFormInstance ( TUnimForm1 ) );
end;

end.
 

 

 


  • 0





Also tagged with one or more of these keywords: unimForm, dll

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users