Modify

Opened 11 years ago

Closed 11 years ago

#2861 closed Bug (Fixed)

_WinAPI_ReadDirectoryChanges not working

Reported by: anonymous Owned by: Jpm
Milestone: 3.3.13.19 Component: AutoIt
Version: 3.3.12.0 Severity: None
Keywords: Cc:

Description

#include <APIFilesConstants.au3>
#include <Array.au3>
#include <MsgBoxConstants.au3>
#include <WinAPIDiag.au3>
#include <WinAPIFiles.au3>
#include <WinAPISys.au3>

Global $g_sPath = @TempDir & '\~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 $hDirectory = _WinAPI_CreateFileEx($g_sPath, $OPEN_EXISTING, $FILE_LIST_DIRECTORY, BitOR($FILE_SHARE_READ, $FILE_SHARE_WRITE), $FILE_FLAG_BACKUP_SEMANTICS)
If @error Then
    _WinAPI_ShowLastError('', 1)
EndIf

Local $pBuffer = _WinAPI_CreateBuffer(8388608)

Local $aData
While 1
    $aData = _WinAPI_ReadDirectoryChanges($hDirectory, BitOR($FILE_NOTIFY_CHANGE_FILE_NAME, $FILE_NOTIFY_CHANGE_DIR_NAME), $pBuffer, 8388608, 1)
    If Not @error Then
        _ArrayDisplay($aData, '_WinAPI_ReadDirectoryChanges')
    Else
        _WinAPI_ShowLastError('', 1)
    EndIf
WEnd

Func OnAutoItExit()
    DirRemove($g_sPath, 1)
EndFunc   ;==>OnAutoItExit

File name is not returned when the directory changes.

Change History (1)

comment:1 Changed 11 years ago by Jpm

  • Milestone set to 3.3.13.19
  • Owner set to Jpm
  • Resolution set to Fixed
  • Status changed from new to closed

Fixed by revision [11010] in version: 3.3.13.19

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.

Add Comment

Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.