X
xiang8410
Unregistered / Unconfirmed
GUEST, unregistred user!
//DLL项目文件
library ReportDLL;
uses
sharemem,
SysUtils,
Classes,
ActiveX,
Uselect in 'Uselect.pas' {FSelect};
{$R *.res}
exports
ShowFSelect;
begin
end.
//DLL里的Uselect.pas
var
FSelect: TFSelect;
procedure ShowFSelect(aHandle:THandle);stdcall;
implementation
{$R *.dfm}
procedure ShowFSelect(aHandle:THandle);
begin
try
CoInitialize(nil);
//本来没加这一行的话就是报"尚未调用CoInitialize"
加了 这行之后就出现以下的问题
Application.Handle:=aHandle;
with TFSelect.Create(Application)do
begin
try
FSelect.Show;
finally
free;
end;
end;
except on e:Exceptiondo
showmessage(e.Message);
end;
CoUnInitialize();
end;
///////////这下面还有很多事件代码,因为之前是做成普通的.EXE,现在想做成.DLL
//调用DLL的文件
var
Report: TReport;
procedure ShowFSelect(aHandle:THandle);
stdcall external 'D:/ReportDLL/ReportDLL.dll';
implementation
{$R *.dfm}
procedure TReport.ReportClick(Sender: TObject);
begin
ShowFSelect(Application.Handle);
end;
报错是:Access violation at address 00A4222 in module ReportDLL.dll'.Read of address 000002EC
请问我的程序错哪了?能帮我指点一下吗?万分感谢~~~~
library ReportDLL;
uses
sharemem,
SysUtils,
Classes,
ActiveX,
Uselect in 'Uselect.pas' {FSelect};
{$R *.res}
exports
ShowFSelect;
begin
end.
//DLL里的Uselect.pas
var
FSelect: TFSelect;
procedure ShowFSelect(aHandle:THandle);stdcall;
implementation
{$R *.dfm}
procedure ShowFSelect(aHandle:THandle);
begin
try
CoInitialize(nil);
//本来没加这一行的话就是报"尚未调用CoInitialize"
加了 这行之后就出现以下的问题
Application.Handle:=aHandle;
with TFSelect.Create(Application)do
begin
try
FSelect.Show;
finally
free;
end;
end;
except on e:Exceptiondo
showmessage(e.Message);
end;
CoUnInitialize();
end;
///////////这下面还有很多事件代码,因为之前是做成普通的.EXE,现在想做成.DLL
//调用DLL的文件
var
Report: TReport;
procedure ShowFSelect(aHandle:THandle);
stdcall external 'D:/ReportDLL/ReportDLL.dll';
implementation
{$R *.dfm}
procedure TReport.ReportClick(Sender: TObject);
begin
ShowFSelect(Application.Handle);
end;
报错是:Access violation at address 00A4222 in module ReportDLL.dll'.Read of address 000002EC
请问我的程序错哪了?能帮我指点一下吗?万分感谢~~~~