Opened 10 years ago
Closed 7 years ago
#2925 closed Bug (Wont Fix)
_WinAPI_ShellChangeNotifyRegister problem
Reported by: | linbin | Owned by: | |
---|---|---|---|
Milestone: | Component: | AutoIt | |
Version: | 3.3.12.0 | Severity: | None |
Keywords: | _WinAPI_ShellChangeNotifyRegister | Cc: |
Description
#include <APIShellExConstants.au3> #include <MsgBoxConstants.au3> #include <WinAPI.au3> #include <WinAPIShellEx.au3> Opt('TrayAutoPause', 0) Global Const $g_sPath = @ScriptDir & '\~TEST~' DirCreate($g_sPath) If Not FileExists($g_sPath) Then MsgBox(BitOR($MB_ICONERROR, $MB_SYSTEMMODAL), 'Error', 'Unable to create folder.') Exit EndIf OnAutoItExitRegister('OnAutoItExit') Local $hWnd = GUICreate('') Local $iMsg = _WinAPI_RegisterWindowMessage('SHELLCHANGENOTIFY') GUIRegisterMsg($iMsg, 'WM_SHELLCHANGENOTIFY') Global $g_iID = _WinAPI_ShellChangeNotifyRegister($hWnd, $iMsg, $SHCNE_ALLEVENTS, BitOR($SHCNRF_INTERRUPTLEVEL, $SHCNRF_SHELLLEVEL, $SHCNRF_RECURSIVEINTERRUPT), $g_sPath, 1) If @error Then MsgBox(BitOR($MB_ICONERROR, $MB_SYSTEMMODAL), 'Error', 'Window does not registered.') Exit EndIf While 1 Sleep(1000) WEnd Func WM_SHELLCHANGENOTIFY($hWnd, $iMsg, $wParam, $lParam) #forceref $hWnd, $iMsg Local $sPath = _WinAPI_ShellGetPathFromIDList(DllStructGetData(DllStructCreate('dword Item1; dword Item2', $wParam), 'Item1')) If $sPath Then ConsoleWrite('Event: 0x' & Hex($lParam) & ' | Path: ' & $sPath & @CRLF) Else ConsoleWrite('Event: 0x' & Hex($lParam) & @CRLF) EndIf EndFunc ;==>WM_SHELLCHANGENOTIFY Func OnAutoItExit() If $g_iID Then _WinAPI_ShellChangeNotifyDeregister($g_iID) EndIf DirRemove($g_sPath) EndFunc ;==>OnAutoItExit
It's the Example script from Help file,and it's not working very well on WinXP.
1.Win7
run the script on Win7 and download a file(QQ6.4.exe) via Firefox.
console output:
"C:\Program Files (x86)\AutoIt3\SciTE\..\autoit3.exe" /ErrorStdOut "D:\1.au3"
Event: 0x00000008 | Path: D:\~TEST~
Event: 0x00040000
Event: 0x00000004 | Path: D:\~TEST~\QQ6.4.exe
Event: 0x00000002 | Path: D:\~TEST~\QQ6.4.exe
Event: 0x00000002 | Path: D:\~TEST~\QQ6.4.exe.part
Event: 0x00002000 | Path: D:\~TEST~\QQ6.4.exe.part
Event: 0x00002000 | Path: D:\~TEST~
Event: 0x00002000 | Path: D:\~TEST~\QQ6.4.exe.part
Event: 0x00000004 | Path: D:\~TEST~\QQ6.4.exe
Event: 0x00000001 | Path: D:\~TEST~\QQ6.4.exe.part
Event: 0x00002000 | Path: D:\~TEST~\QQ6.4.exe
Event: 0x00002000 | Path: D:\~TEST~
2.WinXP
run it again on WinXP and download the same file via Firefox
console output:
Running:(3.3.12.0):D:\Program Files\AutoIt3\autoit3.exe "D:\1.au3"
--> Press Ctrl+Alt+F5 to Restart or Ctrl+Break to Stop
Event: 0x00001000 | Path: D:\~TEST~
Event: 0x00001000 | Path: D:\~TEST~
It seems the function cannot detect temp file on WinXP?
Attachments (0)
Change History (1)
comment:1 Changed 7 years ago by Jpm
- Reporter changed from linbin to linbin
- Resolution set to Wont Fix
- Status changed from new to closed
Guidelines for posting comments:
- You cannot re-open a ticket but you may still leave a comment if you have additional information to add.
- In-depth discussions should take place on the forum.
For more information see the full version of the ticket guidelines here.