//对于Delphi Dll中不能用string做接口
//看看我的Dll
library PicturesPr;uses
SysUtils,
Classes,
Windows,
Forms,
PictureUnit in 'PictureUnit.pas' {FormPicture},
FunctionUnit in 'FunctionUnit.pas';{$R *.RES}var
V_FileName: string; //图形文件名
V_OnShowForm: TNotifyEvent; //显示窗体的事件
V_OnCloseForm: TNotifyEvent; //关闭窗体的事件procedure SetOnShowForm(mOnShowForm: TNotifyEvent); stdcall;
begin
V_OnShowForm := mOnShowForm;
end;procedure SetOnCloseForm(mOnCloseForm: TNotifyEvent); stdcall;
begin
V_OnCloseForm := mOnCloseForm;
end;function GetFileName: PChar; stdcall;
begin
Result := PChar(V_FileName);
end;procedure SetFileName(mFileName: PChar); stdcall;
begin
V_FileName := string(mFileName);
end;procedure ExeFormPicture; stdcall;
var
vFileName: TFileName;
begin
vFileName := TFileName(V_FileName);
DoFormPicture(vFileName, V_OnShowForm, V_OnCloseForm);
V_FileName := PChar(vFileName)
end;exports
ExeFormPicture, GetFileName, SetFileName, SetOnShowForm, SetOnCloseForm;end.
//看看我的Dll
library PicturesPr;uses
SysUtils,
Classes,
Windows,
Forms,
PictureUnit in 'PictureUnit.pas' {FormPicture},
FunctionUnit in 'FunctionUnit.pas';{$R *.RES}var
V_FileName: string; //图形文件名
V_OnShowForm: TNotifyEvent; //显示窗体的事件
V_OnCloseForm: TNotifyEvent; //关闭窗体的事件procedure SetOnShowForm(mOnShowForm: TNotifyEvent); stdcall;
begin
V_OnShowForm := mOnShowForm;
end;procedure SetOnCloseForm(mOnCloseForm: TNotifyEvent); stdcall;
begin
V_OnCloseForm := mOnCloseForm;
end;function GetFileName: PChar; stdcall;
begin
Result := PChar(V_FileName);
end;procedure SetFileName(mFileName: PChar); stdcall;
begin
V_FileName := string(mFileName);
end;procedure ExeFormPicture; stdcall;
var
vFileName: TFileName;
begin
vFileName := TFileName(V_FileName);
DoFormPicture(vFileName, V_OnShowForm, V_OnCloseForm);
V_FileName := PChar(vFileName)
end;exports
ExeFormPicture, GetFileName, SetFileName, SetOnShowForm, SetOnCloseForm;end.
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货