不知道这个对你是不是有用,是先人的结晶哦
我想用一个窗体作为一个dll,
主程序中调用怎么调用这个dll窗体呢?
谁能给一个简单的例子么?
谢谢!!
来自:YunEr, 时间:2001-4-25 22:48:00, ID:515893
library About;
uses
SysUtils,
Classes,
CreatAboutUnit in 'unit1.pas';
exports
CreatAbout Index 1 name 'CreatAbout',
==================================
Unit unit1;
Interface
Uses
Windows, Messages, SysUtils, Classes, Graphics, Forms;
Type
TFormAbout = Class(TForm)
Private
{ Private declarations }
Public
{ Public declarations }
End;
Function CreatAbout (FormHandle : THandle
: Boolean
stdcall;
Var
FormAbout : TFormAbout;
Implementation
{$R *.DFM}
Function CreatAbout(FormHandle : THandle
: Boolean;
Begin
.......
End;
End.
=====================================================
主程序
function CreatAbout(FormHandle : THandle
:THandle;stdcall;
external 'About.dll' name 'CreatAbout';
^^^^^^^^^^假设是这个DLL名字
...........
procedure TForm1.button1Click(Sender: TObject);
begin
CreatAbout(Form1.handle);
end;
来自:吴剑明, 时间:2001-5-9 16:21:00, ID:525811
在DLL里包含一个方法,在这个方法里CREATE一个FORM,然后SHOW出来就可以了。:)
很简单的
来自:iie, 时间:2001-5-9 16:34:00, ID:525824
应该是在DLL中输出函数吧,
方法怎么输出?我还没学过,呵呵。
来自:Tintin, 时间:2001-5-10 13:05:00, ID:526506
使用 export 关键字
来自:watter, 时间:2001-10-15 10:53:00, ID:673374
unit UnitGetDate;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, Buttons, ComCtrls, ExtCtrls;
type
TfrmGetDate = class(TForm)
Bevel1: TBevel;
MonthCalendar1: TMonthCalendar;
bbtnOK: TBitBtn;
bbtnCancel: TBitBtn;
procedure MonthCalendar1DblClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
frmGetDate: TfrmGetDate;
Function GetDate:TDate;export;
implementation
{$R *.DFM}
Function GetDate:TDate;
begin
frmGetDate:=TfrmGetDate.Create(Application);
try
if frmGetDate.ShowModal=IDOK then
Result:=frmGetDate.MonthCalendar1.Date
else frmGetDate.Close;
Finally
frmGetDate.Free;
end;
end;
procedure TfrmGetDate.MonthCalendar1DblClick(Sender: TObject);
begin
GetDate;
end;
end.
使用DLL文件中封装的窗口
http://www.csdn.net/develop/article/10/10919.shtm