Results 1 to 2 of 2

Thread: Help the old guy

  1. #1
    vbGrandpa
    Guest

    Help the old guy

    I'm trying to determine directory structure changes from
    Windows 95/98 and Windows ME.

    Any ideas?

    Thanx,
    Grandpa

  2. #2
    PowerPoster
    Join Date
    Jul 1999
    Posts
    5,923
    look at

    FindFirstChangeNotification
    FindNextChangeNotification
    FindCloseChangeNotification APIs

    Example
    VB Code:
    1. Private Const FILE_NOTIFY_CHANGE_ATTRIBUTES = &H4
    2. Private Const FILE_NOTIFY_CHANGE_DIR_NAME = &H2
    3. Private Const FILE_NOTIFY_CHANGE_FILE_NAME = &H1
    4. Private Const FILE_NOTIFY_CHANGE_SIZE = &H8
    5. Private Const FILE_NOTIFY_CHANGE_LAST_WRITE = &H10
    6. Private Const FILE_NOTIFY_CHANGE_SECURITY = &H100
    7. Private Const FILE_NOTIFY_CHANGE_ALL = &H4 Or &H2 Or &H1 Or &H8 Or &H10 Or &H100
    8. Private Declare Function FindFirstChangeNotification Lib "kernel32" Alias "FindFirstChangeNotificationA" (ByVal lpPathName As String, ByVal bWatchSubtree As Long, ByVal dwNotifyFilter As Long) As Long
    9. Private Declare Function FindCloseChangeNotification Lib "kernel32" (ByVal hChangeHandle As Long) As Long
    10. Private Declare Function FindNextChangeNotification Lib "kernel32" (ByVal hChangeHandle As Long) As Long
    11. Private Declare Function WaitForSingleObject Lib "kernel32" (ByVal hHandle As Long, ByVal dwMilliseconds As Long) As Long
    12. Private Declare Function ResetEvent Lib "kernel32" (ByVal hEvent As Long) As Long
    13. Private Sub Form_Load()
    14.     'KPD-Team 2000
    15.     'URL: [url]http://www.allapi.net/[/url]
    16.     'E-Mail: [email][email protected][/email]
    17.     Dim Ret As Long
    18.     'Set the notification hook
    19.     Ret = FindFirstChangeNotification("C:\", &HFFFFFFFF, FILE_NOTIFY_CHANGE_ALL)
    20.     'Wait until the event is triggered
    21.     WaitForSingleObject Ret, &HFFFFFFFF
    22.     MsgBox "Event Triggered for the first time"
    23.     'Reactivate our hook
    24.     FindNextChangeNotification Ret
    25.     'Wait until the event is triggered
    26.     WaitForSingleObject Ret, &HFFFFFFFF
    27.     MsgBox "Event Triggered for the second time"
    28.     'Remove our hook
    29.     FindCloseChangeNotification Ret
    30. End Sub

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width