如何把窗体做进DLL呀,又怎么调用DLL窗体呢?各位大哥能贴一个简单的列子吗。谢谢。
解决方案 »
- 进程大小
- 鏈嶅姟鍣ㄦ€庢牱鍔ㄦ€佺殑鍒嗛厤绔彛缁欐瘡涓鎴风?.
- 在delphi如何对 http://xxx.xxx.xxx.xxx/xxx.aspx?xm=张三 中的汉字编码?
- Access中联合查询的问题?在线等。。。。
- 如何将QReport做的报表输出为一个打印文件?
- 在线等候,救急!
- 挑战极限,高手请进!百分相赠!!!!
- 如何提高查询DBRichEdit内中文字符的速度?
- 是否有和fsStayontop类似的属性
- 很急,我想要一个取字符串左边第1至x位,或截掉字符串最后三位的函数。
- 出现“ambiguous column name ‘var'这个问题应如何解决?
- 求一个能查找目录下面所有文件的算法!先到的有分!
其次在DLL中建立一个函数
函数代码如下
function xxxxx: integer; stdcall;
begin
.
.
.
from1.carete(nil);
.
.
.
end;
其实就是新建一个DLL工程,然后引用设计好的窗体,在DLL中创建该窗体即可。
library DLLForm;{ Important note about DLL memory management: ShareMem must be the
first unit in your library's USES clause AND your project's (select
Project-View Source) USES clause if your DLL exports any procedures or
functions that pass strings as parameters or function results. This
applies to all strings passed to and from your DLL--even those that
are nested in records and classes. ShareMem is the interface unit to
the BORLNDMM.DLL shared memory manager, which must be deployed along
with your DLL. To avoid using BORLNDMM.DLL, pass string information
using PChar or ShortString parameters. }uses
SysUtils,
Classes,
Forms,
ComObj,
MainUnit in 'MainUnit.pas' {Form1};{$R *.res}
//begin
function ShowForm(aHandle: THandle; aCaption: PChar): Boolean;stdcall;
var
Form1: TForm1;
begin
Result := false;
Application.Handle := aHandle;
Form1 := TForm1.Create(Application);
try
Form1.Label1.Caption := aCaption;
Form1.ShowModal;
finally
Form1.Free;
end;
Result := true;
end;exports ShowForm;
end.窗体文件:unit MainUnit;interfaceuses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, OleCtrls, Buttons;type
TForm1 = class(TForm)
Label1: TLabel;
BitBtn1: TBitBtn;
BitBtn2: TBitBtn;
Map1: TMap;
procedure BitBtn2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;implementation
uses ComObj;{$R *.dfm}procedure TForm1.BitBtn2Click(Sender: TObject);
begin
Close;
end;end.
上次忘了贴地址