帮我看一看错误

ThreeYears 2003-04-25 04:10:04
帮我看一看错误 
//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;
...全文
109 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
ylmg 2003-04-25
  • 打赏
  • 举报
回复
type
Tcalnedar=function ShowCalendar(AHandle: THandle; ACaption: pchar):TDateTime;stdcall;

这是要声明一个函数类型啊,当然不能带ShowCalendar了,
现去看看object pascal再来学delphi吧,会轻松点的。
u2m 2003-04-25
  • 打赏
  • 举报
回复
Tcalnedar=function ShowCalendar(AHandle: THandle; ACaption: pchar):TDateTime;stdcall;
改为
Tcalnedar=function (AHandle: THandle; ACaption: pchar):TDateTime;stdcall;
把ShowCalendar去掉

1,184

社区成员

发帖
与我相关
我的任务
社区描述
Delphi Windows SDK/API
社区管理员
  • Windows SDK/API社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧