请教下VB的API转换
Declare Function FindFirstChangeNotification Lib "kernel32" Alias "FindFirstChangeNotificationA" (ByVal lpPathName As String, ByVal bWatchSubtree As Long, ByVal dwNotifyFilter As Long) As Long
以上代码在autoit中如何转换?
新手,不知道代码有没有错,本意是想问下API的FindFirstChangeNotification在autoit的用法. 巧了。。刚才还在钻研这个api,成果分享下~
$dwNotifyFilter = bitOr(1, 2, 4, 8)
$hNotification = DllCall("kernel32.dll", "hWnd", "FindFirstChangeNotification", _
"str", @ScriptDir, "int", True, "dword", $dwNotifyFilter)
While True
$dwResult = DllCall("kernel32.dll", "dword", "WaitForSingleObject", _
"hWnd", $hNotification, "dword", 100000)
If not $dwResult Then msgbox(0, $dwResult, '')
DllCall("kernel32.dll", "int", "FindNextChangeNotification", "hWnd", $hNotification)
WEnd
Func OnAutoItExit()
DllCall("kernel32.dll", "int", "FindCloseChangeNotifycation", "hWnd", $hNotification)
Exit(0)
EndFunc ;==>OnAutoItExit()
测试方法,在当前脚本(子)目录新建/删除/重命名文件,会弹出个提示。但还不能截取到是哪个文件发生了改变。在ReadDirectoryChangesW处卡壳了~ 谢谢LS.
又找了相关方面的资料,原来ReadDirectoryChangesW()以及FindFirstChangeNotification()都会存在漏报的情况.此问题的更好解决方法是使用文件驱动过滤,头大啊!
不知道论坛有没有VC高手来帮忙注释下filemon的源码.
页:
[1]