dll调用

jige5d 2012-02-07 04:18:13
function hi_32 hi_sdk_Init():THandle;stdcall;external'HISDK.dll';
错误是 Function needs result type

hi_32 hi_sdk_Init()是初始化函数
result values HI_success表示成功 HI_failure表示失败

要怎么写这个返回值
谢谢
...全文
95 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
jige5d 2012-02-07
  • 打赏
  • 举报
回复
[Quote=引用 5 楼 gobiz 的回复:]

试试这样:

Delphi(Pascal) code
type
TForm1 = class(TForm)
Button1: TButton;
Image1: TImage;
GroupBox1: TGroupBox;
procedure Button1Click(Sender: TObject);

private
{ Private declarations……
[/Quote]
非常感谢啊 能留个联系方式么 我qq971470444

gobiz 2012-02-07
  • 打赏
  • 举报
回复
试试这样:

type
TForm1 = class(TForm)
Button1: TButton;
Image1: TImage;
GroupBox1: TGroupBox;
procedure Button1Click(Sender: TObject);

private
{ Private declarations }
public
{ Public declarations }
end;
function hi_sdk_Init(var husb: THandle): Integer; stdcall; external'HISDK.dll'; //<--注意这里,添加一个var标识
var
Form1: TForm1;
sdk_Init:THandle;

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
begin
hi_sdk_Init(sdk_Init); //<--注意这里,这样调用
end;

end.
gobiz 2012-02-07
  • 打赏
  • 举报
回复
这里是这么定义的:
function hi_sdk_Init(husb:THandle):Integer;stdcall;external'HISDK.dll';


那么调用的时候应该这样:
procedure TForm1.Button1Click(Sender: TObject);
var
h: THandle;
begin
sdk_Init := hi_sdk_Init(h);
end;
jige5d 2012-02-07
  • 打赏
  • 举报
回复
[Quote=引用 2 楼 sgzhou12345 的回复:]

根据情况而定,
一是:静态调用
二是:动态调用
[/Quote]
是静态调用的

type
TForm1 = class(TForm)
Button1: TButton;
Image1: TImage;
GroupBox1: TGroupBox;
procedure Button1Click(Sender: TObject);

private
{ Private declarations }
public
{ Public declarations }
end;
function hi_sdk_Init(husb:THandle):Integer;stdcall;external'HISDK.dll';
var
Form1: TForm1;
sdk_Init:THandle;

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
begin
sdk_Init:=hi_sdk_Init();
end;

end.


sdk_Init:=hi_sdk_Init();错误Not enough actual parameters 要怎么写啊 这个sdk给的不是很详细 第一次写不太会 谢谢
山东蓝鸟贵薪 2012-02-07
  • 打赏
  • 举报
回复
根据情况而定,
一是:静态调用
二是:动态调用
ljking0731 2012-02-07
  • 打赏
  • 举报
回复
function hi_32 hi_sdk_Init():Integer;stdcall;external'HISDK.dll';

或者
function hi_32 hi_sdk_Init():Cardinal;stdcall;external'HISDK.dll';

1,184

社区成员

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

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