各位大侠,有问题请教(180分)

  • 主题发起人 花园风味
  • 开始时间

花园风味

Unregistered / Unconfirmed
GUEST, unregistred user!
我在我的Dll(MDI加载Dll)的窗体中,ShowHint,会出错!
“Exception EConvertError in ...”

气死我了!怎么搞?!遇到过吗?给点建议!谢谢!

附:dll代码
library testDlls001;

uses
SysUtils,
Classes,
Windows,
Forms,
DevShare,
Unt_Child in 'Unt_Child.pas' {FrmChild001};

{$R *.RES}

var
OldApplication: TApplication;
OldScreen: TScreen;

procedure DLLEntryPoint(dwReason : DWord);
begin
case dwReason of //此处还可以加入线程入口
DLL_PROCESS_ATTACH: //载入DLL
begin
OldApplication := Application;
OldScreen := Screen;
end;
DLL_PROCESS_DETACH: //卸载DLL
begin
Application := OldApplication;
Screen := OldScreen;
end;
end;
end;

//// 运行DLL主窗口 //////////////////////////////////////
procedure RunApp(param: TDLLParam); stdcall;
begin
dllParam := param; //获取参数
Screen := param.scr;
Application := param.app;
FrmChild001 := TFrmChild001.Create(Application); //to do: 将DllForm修改为你的
end;

//// 显示DLL主窗口 //////////////////////////////////////
procedure ShowApp; stdcall;
var
i: Integer;
ccFind: Boolean;
begin
ccFind := False;
for i := 0 to Application.MainForm.MDIChildCount - 1 do
if Application.MainForm.MDIChildren.Name = FrmChild001.Name then //to do: 将DllForm修改为你的
begin
ccFind := True;
Break;
end;

if not ccFind then
FrmChild001 := TFrmChild001.Create(Application);

FrmChild001.BringToFront;
end;

//////////////////////////////////////////////////////////////////////
exports
RunApp, ShowApp;

begin
DLLProc := @DLLEntryPoint;
DLLEntryPoint(DLL_PROCESS_ATTACH);
end.

在FrmChild001中只要ShowHint就会出错!
但是TreeView自身的ShowHint没错!:(
郁闷!
急!
 

给点思路也好!:(
在线等待...
 
那是因为你对 Application 的 ShowHint
Application.ShowHint := True;

DLL 中没有 Application 对象 。
 
to jsxjd
我的Dll中传递了主程序的App
你说的“那是因为你对 Application 的 ShowHint
Application.ShowHint := True;”
应该在哪个位置?在Dll中的FormCreate中吗?
我试了,不行!还是同样的错!:(
麻烦给个可行的范例!谢谢!
 
[:(]
[:(!]
为什么我的问题这么不受欢迎?!
 
jsxjd,便宜你了![:D]
新年新气象!
旧的不去新的不来!
[:)][:D][^]
 
顶部