DLL file usage

zhaozj2021-02-17  49

Topic: Use of FORM in DLL file (2)

Before leaving this article, there is no similar article, if you have the same, please forgive me, and notices (Note: I have called a form of a window in the same dll, how to implement the problem, please teach a predecessor, But the seniors smiled unreasonable), this is a way I think when I write a dynamic component, and the results are all forgiven. I am a beginner, and I'm going to see hard, I'm just looking like an object, I will give some help, no him. Library DLLPJ;

Uses sysutils, classes, unit1 in 'unit1.pas' {form1}, unit2 in 'unit2.pas' {form2};

{$ R * .res}

Exports ShowMainPrgwin; Beginend. ---------- Unit Unit1;

Interface

uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Unit2, Dialogs, StdCtrls; // 1 form attachment means applied here type TForm1 = class (TForm) Button1:. TButton; procedure Button1Click (Sender : TOBJECT); private {private declarations}} end;

Var Form1: TForm1; Form2: TFORM2; // 2. Refine the Function of Windows of the Main DllFunction of Windows of the Main Dllfunction SHOWMAINPRGWIN (AHANDLE: THANDLE): BOOL; stdcall;

IMPLEMENTATION

{$ R * .dfm} Function ShowMainPRGWIN (AHANDLE: THANDLE): Bool; Begin Form1: = TFORM1.CREATE (Application); Form2: = TFORM2.CREATE (Application); // 3. Create a Wind Try Form1.ShowModal Result: = FALSE; FINALLY FORM1.FREE; END; END;

Procedure tForm1.Button1Click (Sender: TOBJECT); Begin Form2.showModal; // 4. Tune the window body END on the main form;

End. ------------ Unit unit2;

Interface

Uses Windows, Messages, Sysutils, Variants, Classes, Graphics, Controls, Forms, Dialogs

TYPE TFORM2 = Class (TForm) private {private declarations}

Var Form2: TFORM2;

IMPLEMENTATION

{$ R * .dfm}

End. ---------- // Call the DLL on other forms Procedure ShowMainPrgwin (AHandle: Thandle); stdcall external 'dllpj.dll';

ShowMainPrgwin (1);

转载请注明原文地址:https://www.9cbs.com/read-29841.html

New Post(0)