---------------------------
Debugger Exception Notification
---------------------------
Project Spider.exe raised exception class EOleSysError with message '标记没有引用存储'. Process stopped. Use Step or Run to continue.
---------------------------
OK Help
---------------------------
library read_data;uses
SysUtils,
Classes,
read_unit in 'read_unit.pas' {read_form},
DataMod in 'DataMod.pas' {DataMod1: TDataModule},
show_data_unit in 'show_data_unit.pas' {Show_data_form};//模式显示窗口
exports
ShowDLLModalForm,ShowDLLForm;{$R *.res}beginend.
//====DLL中EXPORT的程序如下:
procedure ShowDLLModalForm(aHandle: THandle);
procedure ShowDLLForm(aHandle: THandle);var
read_form: Tread_form;
currentdir_beg:string;
implementationuses DataMod, show_data_unit;{$R *.dfm}
procedure ShowDLLModalForm(aHandle: THandle);
begin
Application.Handle := aHandle; //传递应用程序句柄
datamod1:=tdatamod1.Create(application);
read_form:=Tread_form.Create(Application); //创建窗体
try
read_form.Show; //模式显示窗体
finally
read_form.Free;
end;
end;//非模式显示窗口
procedure ShowDLLForm(aHandle: THandle);
begin
datamod1:=tdatamod1.Create(application);
Application.Handle := aHandle; //传递应用程序句柄
read_form:=Tread_form.Create(application); //创建窗体
read_form.Show; //非模式显示窗体
end;
调用如下
procedure TMain_form.BitBtn1Click(Sender: TObject);
var
DLLHandle: THandle;
ShowDLLForm : TShowDLLForm;
begin
DLLHandle := LoadLibrary('read_data.dll');
{如果DLLHandle为0,代表加载DLL失败}
if DLLHandle = 0 then
raise EDLLError.Create('read_data.dll'); @ShowDLLForm := GetProcAddress(DLLHandle, 'ShowDLLForm');
if (@ShowDLLForm = nil) then
RaiseLastWin32Error;
ShowDLLForm(Application.Handle);
end;
Debugger Exception Notification
---------------------------
Project Spider.exe raised exception class EOleSysError with message '标记没有引用存储'. Process stopped. Use Step or Run to continue.
---------------------------
OK Help
---------------------------
library read_data;uses
SysUtils,
Classes,
read_unit in 'read_unit.pas' {read_form},
DataMod in 'DataMod.pas' {DataMod1: TDataModule},
show_data_unit in 'show_data_unit.pas' {Show_data_form};//模式显示窗口
exports
ShowDLLModalForm,ShowDLLForm;{$R *.res}beginend.
//====DLL中EXPORT的程序如下:
procedure ShowDLLModalForm(aHandle: THandle);
procedure ShowDLLForm(aHandle: THandle);var
read_form: Tread_form;
currentdir_beg:string;
implementationuses DataMod, show_data_unit;{$R *.dfm}
procedure ShowDLLModalForm(aHandle: THandle);
begin
Application.Handle := aHandle; //传递应用程序句柄
datamod1:=tdatamod1.Create(application);
read_form:=Tread_form.Create(Application); //创建窗体
try
read_form.Show; //模式显示窗体
finally
read_form.Free;
end;
end;//非模式显示窗口
procedure ShowDLLForm(aHandle: THandle);
begin
datamod1:=tdatamod1.Create(application);
Application.Handle := aHandle; //传递应用程序句柄
read_form:=Tread_form.Create(application); //创建窗体
read_form.Show; //非模式显示窗体
end;
调用如下
procedure TMain_form.BitBtn1Click(Sender: TObject);
var
DLLHandle: THandle;
ShowDLLForm : TShowDLLForm;
begin
DLLHandle := LoadLibrary('read_data.dll');
{如果DLLHandle为0,代表加载DLL失败}
if DLLHandle = 0 then
raise EDLLError.Create('read_data.dll'); @ShowDLLForm := GetProcAddress(DLLHandle, 'ShowDLLForm');
if (@ShowDLLForm = nil) then
RaiseLastWin32Error;
ShowDLLForm(Application.Handle);
end;
begin
Application.Handle := aHandle; //传递应用程序句柄
CoInitialize(nil); //uses Activex;
datamod1:=tdatamod1.Create(application);
read_form:=Tread_form.Create(Application); //创建窗体
try
read_form.ShowModal; //模式显示窗体
finally
FreeAndNil(read_form);
CoUninitalize;
end;
end;