帮我看一看错误
帮我看一看错误
//dll中:
var
Dllform: TDllform;
function ShowCalendar(AHandle: THandle; ACaption: pchar): TDateTime;
implementation
{$R *.DFM}
function ShowCalendar(AHandle: THandle; ACaption:pchar): TDateTime;
begin
Application.Handle := AHandle;
DLLForm := TDLLForm.Create(Application); //创建并显示窗体
try
DLLForm.Caption := ACaption;
DLLForm.ShowModal; //显示方式为模式化
Result := DLLForm.calDLLCalendar.date; //返回设定日期
finally
DLLForm.Free; //用完后卸载该窗体end;
end;
end;
//调用:
type
Tcalnedar=function ShowCalendar(AHandle: THandle; ACaption: pchar):TDateTime;stdcall;
//出错[Error] Unit1.pas(10): Function needs result type
procedure TForm1.Button1Click(Sender: TObject);
var
libhandle:Thandle;
calendar:Tcalendar;
begin
libhandle:=loadlibrary('testdll.dll');
try
if libhandle=0 then
exit;
@calendar:=Getprocaddress(libhandle,ShowCalendar);
if not (@calendar=nil) then
edit1.text:=ShowCalendar(application.handle,'testdll');
finally
exit;
end;
end;