引用DLL的问题

kafly 2007-04-14 02:07:39
HRESULT _stdcall SetCursorPos([in] int iCursorPosX, [in] int iCursorPosY );

返回类型是HRESULT
这个DLL函数怎么在DELPHI里申明?

...全文
273 10 打赏 收藏 转发到动态 举报
写回复
用AI写文章
10 条回复
切换为时间正序
请发表友善的回复…
发表回复
dd_zhouqian 2007-04-30
  • 打赏
  • 举报
回复
是整型吧
上面都说是integer了 啊?
scfanxzq 2007-04-20
  • 打赏
  • 举报
回复
弱弱的问问:HRESULT 是啥数据类型啊?
startomeyhuang 2007-04-17
  • 打赏
  • 举报
回复
setcursorpos是系统已经申明的函数喔
小呆之家 2007-04-17
  • 打赏
  • 举报
回复

C++:
typedef LONG HRESULT;
HRESULT _stdcall SetCursorPos([in] int iCursorPosX, [in] int iCursorPosY );


Delphi:
function SetCursorPos(iCursorPosX, iCursorPosY:integer ):integer;stdcall;
gou_xp 2007-04-16
  • 打赏
  • 举报
回复

"返回值 HRESULT 怎么处理?"
不明白你返回的是什么数据类型?
如果是bool,就是
if SetCursorPos then
...
else
...

还有'xxxx.dll' ,这里是你的外面动态库名称
chtlovezj 2007-04-16
  • 打赏
  • 举报
回复
function SetCursorPos(X, Y: Integer): BOOL; stdcall;在d里这个函数可以直接调用,不用声明
kafly 2007-04-14
  • 打赏
  • 举报
回复
不行,你这里是静态调用。

我在type里写了
[23] function SetCursorPos(iCursorPosX, iCursorPosY :integer):HRESULT;
在implementation里写了
[29] function SetCursorPos; external 'xxxx.dll' name '_stdcall SetCursorPos';

提示
(23)Unsatisfied forward or external declaration: 'SetCursorPos'
(29)Previous declaration of 'SetCursorPos' was not marked with the 'overload' directive

kafly 2007-04-14
  • 打赏
  • 举报
回复
返回值 HRESULT 怎么处理?
kafly 2007-04-14
  • 打赏
  • 举报
回复
谢谢,先试下。
能不能再给个动态调用的?
gou_xp 2007-04-14
  • 打赏
  • 举报
回复

应该这样声明:

function SetCursorPos(iCursorPosX, iCursorPosY :integer):HRESULT;

implementation

function SetCursorPos; external '*.dll' name '_stdcall SetCursorPos';

我以前也遇到这样的问题的了,就是这样处理的

16,749

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 语言基础/算法/系统设计
社区管理员
  • 语言基础/算法/系统设计社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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