在dll中delphi中封裝窗體

2021-04-20 04:33:55 字數 2510 閱讀 2331

dll工程library formdll;

uses

sysutils,

classes,

forms,

dllform in 'dllform.pas' ,

dllfrom2 in 'dllfrom2.pas' ;

begin

end.

//dll單元檔案一

unit dllform;

inte***ce

uses

windows, messages, sysutils, variants, classes, graphics, controls, forms,

dialogs, stdctrls,inifiles;

type

tfrmdll = class(tform)

button1: tbutton;

procedure button1click(sender: tobject);

private

public

end;

varfrmdll: tfrmdll;

implementation

uses math,dllfrom2;

procedure tfrmdll.button1click(sender: tobject);

begin

self.modalresult := idok;

end;

end.

dll單元檔案二

unit dllfrom2;

inte***ce

uses

windows, messages, sysutils, variants, classes, graphics, controls, forms,

dialogs,inifiles, stdctrls;

type

tform2 = class(tform)

button1: tbutton;

procedure button1click(sender: tobject);

private

public

end;

varform2: tform2;

implementation

procedure tform2.button1click(sender: tobject);

varsmsg : string;

begin

with tinifile.create(extractfilepath(paramstr(0)) + 'config.ini') do

begin

trysmsg := readstring('hello','abc','no');

showmessage(smsg);

finally

free;

end;

end;

end;

end.

測試工程

program test;

uses

forms,

testdllform in 'testdllform.pas' ;

//單元檔案

unit testdllform;

inte***ce

uses

windows, messages, sysutils, variants, classes, graphics, controls, forms,

dialogs, stdctrls,inifiles;

type

tform1 = class(tform)

button1: tbutton;

button2: tbutton;

procedure button1click(sender: tobject);

procedure button2click(sender: tobject);

private

public

end;

varform1: tform1;

implementation

procedure tform1.button2click(sender: tobject);

varsmsg : string;

begin

with tinifile.create(extractfilepath(paramstr(0)) + 'config.ini') do

begin

trysmsg := readstring('hello','abc','no');

showmessage(smsg);

finally

free;

end;

end;

end;

end.

在dll中delphi中封裝窗體 例項

dll工程 library formdll uses sysutils,classes,forms,dllform in dllform.pas dllfrom2 in dllfrom2.pas begin end.dll單元檔案一 unit dllform inte ce uses windows...

在vue中封裝axios

將 axios 新增到vue的原型中 例項物件可以直接使用原型物件中的屬性或方法 所有的元件都是vue的例項 說明 只要是像 axios 這樣的第三方庫 與vue沒有任何關係 都應該通過這種方式來統一匯入 然後在元件中就用this.http代替axios 然後在元件的路徑可以寫成這樣 只要配置了攔擊...

使用DLL檔案中封裝的視窗

一 在dll中封裝視窗 開啟delphi新建乙個dll工程,儲存為usedll,生成 library usedll uses sysutils,classes begin end.新建乙個窗體,新增乙個label和button,設定如下 object form1 tform1 left 192 to...