怎么样调用Dll中的子窗体 怎么样调用Dll中的子窗体 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 帮你顶一下,另再问一个问题,子窗体中如何调用上一级窗体的控件的值?如:From2.Edit1.Text:=From1.Edit1.Text; //这样肯定会出错的:( 你知道怎么样调用Dll中的“子”窗体,不是用ShowModel如是Show的方法? 给你一个调用用DLL的实例:(含有Form的DLL为:DLLShowForm.dll)uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls;type TForm1 = class(TForm) btnShowModal: TButton; BtnShow: TButton; procedure btnShowModalClick(Sender: TObject); procedure BtnShowClick(Sender: TObject); private { Private declarations } public { Public declarations } end;//静态引入DLL中的方法procedure ShowDLLModalForm(aHandle: THandle); stdcall external '..\DLLShowForm.dll';procedure ShowDLLForm(aHandle: THandle); stdcall external '..\DLLShowForm.dll';var Form1: TForm1;implementation{$R *.dfm}//调用DLL里输出的ShowDLLModalForm方法,模式显示窗口procedure TForm1.btnShowModalClick(Sender: TObject);begin ShowDLLModalForm(Application.Handle);end;//调用DLL里输出的ShowDLLForm方法,非模式显示函数procedure TForm1.BtnShowClick(Sender: TObject);begin ShowDLLForm(Application.Handle);end;end. galxh(代码英雄)在unit2中uses unit1 再给你一个调用Form的DLL:(配合上例子)library DLLShowForm;uses SysUtils, Classes, DLLFrm in 'DLLFrm.pas' {frmDLL};{$R *.res}//输出ShowDLLModalForm,ShowDLLForm接口方法,以便外部程序调用exports ShowDLLModalForm, ShowDLLForm;beginend.unit DLLFrm;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs;type TfrmDLL = class(TForm) private { Private declarations } public { Public declarations } end;{声明要引出的方法}procedure ShowDLLModalForm(aHandle: THandle); stdcall; procedure ShowDLLForm(aHandle: THandle); stdcall;implementation{$R *.dfm}//模式显示窗口procedure ShowDLLModalForm(aHandle: THandle);begin Application.Handle := aHandle; with TfrmDLL.Create(Application) do begin try ShowModal; //模式显示窗体 finally free; end; end;end;//非模式显示窗口procedure ShowDLLForm(aHandle: THandle);begin Application.Handle := aHandle; with TfrmDLL.Create(application) do Show; end;end./////具体其他代码在你的Form中写。/// rave 打印 如何用IHTML接口取得鼠标在webbrowser上移动时的坐标 如何把句柄 转化成控件?!! 请大家帮忙看看这个语句有什么问题? olecontainer编辑powerpoint问题 执行完函数后出现EAccessviolation问题? 怎样把程序缩成托盘图标 求csdn工具? 一个很简单的问题 安装ocx时出现错误?? 我在创建一个vcl时,如何把默嫩的图标改为自己的图标。 一句话不好说的数据库问题......高分求教......
From2.Edit1.Text:=From1.Edit1.Text; //这样肯定会出错的:(
(含有Form的DLL为:DLLShowForm.dll)uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;type
TForm1 = class(TForm)
btnShowModal: TButton;
BtnShow: TButton;
procedure btnShowModalClick(Sender: TObject);
procedure BtnShowClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
//静态引入DLL中的方法
procedure ShowDLLModalForm(aHandle: THandle); stdcall external '..\DLLShowForm.dll';procedure ShowDLLForm(aHandle: THandle); stdcall external '..\DLLShowForm.dll';var
Form1: TForm1;implementation{$R *.dfm}
//调用DLL里输出的ShowDLLModalForm方法,模式显示窗口
procedure TForm1.btnShowModalClick(Sender: TObject);
begin
ShowDLLModalForm(Application.Handle);
end;//调用DLL里输出的ShowDLLForm方法,非模式显示函数
procedure TForm1.BtnShowClick(Sender: TObject);
begin
ShowDLLForm(Application.Handle);
end;end.
在unit2中uses unit1
SysUtils,
Classes,
DLLFrm in 'DLLFrm.pas' {frmDLL};
{$R *.res}
//输出ShowDLLModalForm,ShowDLLForm接口方法,以便外部程序调用
exports
ShowDLLModalForm, ShowDLLForm;
begin
end.
unit DLLFrm;interfaceuses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs;type
TfrmDLL = class(TForm)
private
{ Private declarations }
public
{ Public declarations }
end;{声明要引出的方法}
procedure ShowDLLModalForm(aHandle: THandle); stdcall;
procedure ShowDLLForm(aHandle: THandle); stdcall;implementation{$R *.dfm}//模式显示窗口
procedure ShowDLLModalForm(aHandle: THandle);
begin
Application.Handle := aHandle;
with TfrmDLL.Create(Application) do
begin
try
ShowModal; //模式显示窗体
finally
free;
end;
end;
end;
//非模式显示窗口
procedure ShowDLLForm(aHandle: THandle);
begin
Application.Handle := aHandle;
with TfrmDLL.Create(application) do
Show;
end;
end./////具体其他代码在你的Form中写。///