找回密码
 加入
搜索
查看: 2832|回复: 5

[系统综合] [已解决]DllCll调c++写的dll如何调?

[复制链接]
发表于 2011-7-15 14:21:21 | 显示全部楼层 |阅读模式
本帖最后由 gudam 于 2011-7-18 15:17 编辑

在a.dll中有一个方法:
void        a1(wchar_t * test, int& test2)

请问我应该怎样调这个dll,才能获得test和test2的值呢?
发表于 2011-7-15 14:46:41 | 显示全部楼层
搜索论坛
 楼主| 发表于 2011-7-15 15:06:05 | 显示全部楼层
搜索论坛
hzxymkb 发表于 2011-7-15 14:46


我搜了一下,但是没有找到应该怎样写。
http://www.autoitx.com/forum.php ... p;highlight=DllCall
 楼主| 发表于 2011-7-15 16:00:35 | 显示全部楼层
回复 1# gudam

$dll = DllOpen("a.dll")
DllCall($dll, "none", "a1")
Local $test[1024]
Local $test2=0
DllCall($dll, "none", "GetCanExitFlag","wstr",$test,"int",$test2)
DllClose($dll)
MsgBox(0,"",$test2)
我这样写马上就出错了,估计是$test和$test2的设置有错
 楼主| 发表于 2011-7-18 14:42:45 | 显示全部楼层
没人能指点一下嘛
 楼主| 发表于 2011-7-18 15:16:54 | 显示全部楼层
自己解决了- -。
$dll = DllOpen("a.dll")
$test=DllStructCreate("wchar test[32]")  
$test2=0
$calldata=DllCall($dll, "none:cdecl", "a1","ptr",DllStructGetPtr($test),"int*",$test2)
$test2=$calldata[2]
MsgBox(0,"",DllStructGetData($test,"test"))
MsgBox(0,"",$test2)
DllClose($dll)
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-10-1 21:40 , Processed in 0.190740 second(s), 19 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表