找回密码
 加入
搜索
查看: 3835|回复: 3

[AU3基础] _FTP_SetStatusCallback() 是回调函数???????

[复制链接]
发表于 2011-9-29 18:50:16 | 显示全部楼层 |阅读模式
#Include <FTPEx.au3>
_FTP_FileGet($l_FTPSession, $s_RemoteFile, $s_LocalFile [, $fFailIfExists = False, [ $dwFlagsAndAttributes = 0 [, $l_Flags = 0 [, $l_Context = 0]]]])
最后一个可选参数怎么用啊?
帮助文档给的解释是:
$l_Context:[可选参数] A variable that contains the application-defined value that associates this search with any application data.
This is only used if the application has already called _FTP_SetStatusCallback() to set up a status callback function.
还是不能理解是什么意思
_FTP_SetStatusCallback()  是回调函数???????

麻烦能给我解释下么?英文确实看不懂 在线翻译 翻译的不知道说的是什么!!!!
发表于 2011-9-29 19:47:54 | 显示全部楼层
$l_Context是一个任意的32位值,可以设为0、1、2、1234、0xABCD 等任意合法的数值,不能指定为字符串、数组、obj 和 DllStruct结构。_FTP_SetStatusCallBack指定的回调函数必须如下定义:

_InternetStatusCallBack($hInternet, $l_Context, $iInternetStatus, $pStatusInformation, $iStatusInformationLength)


第2个参数$l_Context就是你调用_FTP_FileGet、_FTP_FilePut、_FTP_FindFileFirst时指定的值。这个参数具体有什么作用 需要你自己发挥想象,说没用 这个参数果真没一点用处,说有用那这个参数的用处可大了。

就像_WinAPI_GetWindowLong函数,它有一个功能是获取 关联到指定窗口的自定义数据,对应的功能号为GWL_USERDATA。你若明白了GWL_USERDATA的作用,那以上$l_Context的作用你也会明白了。一些_GUICtrl*_SetItemParam函数中需要的$iParam参数 有相同的意义。

任何需要回调的API,差不多都有这样一个看似无用的Context(有的API声明为lparam或pUserData、pData)参数,如User32.EnumWindows、PowrProf.EnumPwrSchemes、Kernel32.QueueUserAPC、Kernel32.WriteFileEx、Ntdll.NtDeviceIoControlFile。

评分

参与人数 1金钱 +30 收起 理由
iori2882 + 30

查看全部评分

发表于 2011-9-29 21:19:39 | 显示全部楼层
P版懂得真多啊!
 楼主| 发表于 2011-9-30 08:42:33 | 显示全部楼层
$l_Context是一个任意的32位值,可以设为0、1、2、1234、0xABCD 等任意合法的数值,不能指定为字符串、数组 ...
pusofalse 发表于 2011-9-29 19:47

谢谢你的解答 要不还真弄不明白啊~~谢谢了
您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-9-21 00:43 , Processed in 0.074268 second(s), 23 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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