AllApi.net

[an error occurred while processing this directive]
 
'This program shows you how to use the RegNotifyChangeKeyValue-function
'As its name predicts, RegNotifyChangeKeyValue will notify our program
'when the registry changes.
'Follow these steps to test this program:
'1. Start this program
'2. Start Regedit.exe (located in your Windows-directory)
'3. Go to HKEY_CURRENT_USER\Software\VB and VBA Program Settings\Registry Notification
'4. Change one of the values, located in a sub-driectory, or delete this directory
'5. You will see that our program returns from the RegNotifyChangeKeyValue

'WARNING: Playing with the registry can have serious consequences !
'                 If you don't know what you're doing, I advise you not to delete anything

Const HKEY_CLASSES_ROOT = &H80000000
Const HKEY_CURRENT_USER = &H80000001
Const HKEY_LOCAL_MACHINE = &H80000002
Const REG_NOTIFY_CHANGE_NAME = &H1            ' Create or delete (child)
Const REG_NOTIFY_CHANGE_ATTRIBUTES = &H2
Const REG_NOTIFY_CHANGE_LAST_SET = &H4            ' time stamp
Const REG_NOTIFY_CHANGE_SECURITY = &H8
Const REG_LEGAL_CHANGE_FILTER = (REG_NOTIFY_CHANGE_NAME Or REG_NOTIFY_CHANGE_ATTRIBUTES Or REG_NOTIFY_CHANGE_LAST_SET Or REG_NOTIFY_CHANGE_SECURITY)
Private Declare Function RegNotifyChangeKeyValue Lib "advapi32" (ByVal hKey As Long, ByVal bWatchSubtree As Boolean, ByVal dwNotifyFilter As Long, ByVal hEvent As Long, ByVal fAsynchronous As Boolean) As Long
Private Sub Form_Load()
    'KPD-Team 1999
    'URL: http://www.allapi.net/
    'E-Mail: KPDTeam@Allapi.net
    
    'Create a temporary registry key
    SaveSetting "Registry Notification", "Hello", "Testing", "123"
    'Call the function .. This will notify us when something changes at HKEY_CURRENT_USER
    RegNotifyChangeKeyValue HKEY_CURRENT_USER, True, REG_LEGAL_CHANGE_FILTER, AddressOf RegProc, False
    MsgBox "Registry changed"
    Unload Me
End Sub


 
Copyright © 1998-2000, The KPD-Team.
Send mail to KPDTeam@Allapi.net with comments about this web site.
This site is located at
http://www.Allapi.net/