LONG RegNotifyChangeKeyValue(hkey, fWatchSubTree, fdwNotifyFilter, hEvent, fAsync); | |||||
HKEY hkey; | /* open handle to key to watch | */ | |||
BOOL fWatchSubTree; | /* watch key and subkeys? | */ | |||
DWORD fdwNotifyFilter; | /* specifies changes to be reported | */ | |||
HANDLE hEvent; | /* signalled when changes occur | */ | |||
BOOL fAsync; | /* report changes asynchronously? | */ |
The RegNotifyChangeKeyValue function indicates when a registry key or sub-tree has changed.
hkey
Identifies a currently open key or any of the following predefined reserved handle values:
HKEY_CLASSES_ROOT HKEY_CURRENT_USER HKEY_LOCAL_MACHINE HKEY_USERS
fWatchSubTree
If this parameter is TRUE, changes in the specified key and all of its subkeys are reported.
If this parameter is FALSE, only changes in the specified key are reported.
fdwNotifyFilter
Specifies a set of flags that control which changes should be reported. This parameter can be some combination of the following values:
Value | Meaning |
REG_NOTIFY_CHANGE_KEYNAME | ||
Any key name changes that occur in a key or subtree being watched will satisfy a change notification wait. This includes creations and deletions. | ||
REG_NOTIFY_CHANGE_ATTRIBUTES | ||
Any attribute changes that occur in a key or subtree being watched will satisfy a change notification. | ||
REG_NOTIFY_CHANGE_LAST_WRITE | ||
Any last write time changes that occur in a key or subtree being watched will satisfy a change notification. | ||
REG_NOTIFY_CHANGE_SECURITY | ||
Any security descriptor changes that occur in a key or subtree being watched will satisfy a change notification. |
hEvent
Specifies an event handle. If fAsync is TRUE, the function returns immediately, and changes are reported by signalling hEvent.
If fAsync is FALSE, hEvent is ignored.
fAsync
If this parameter is TRUE, the function returns immediately and changes are reported by signalling hEvent.
If this parameter is FALSE, the function does not return until a change has occurred.
The fAsync parameter cannot be TRUE if hEvent does not specify a valid event.
The return value is ERROR_SUCCESS if the function is successful. Otherwise, it is an error value
If hkey is closed the event is signalled. This means that it is possible to return from a wait on the event and then have subsequent functions fail if they try to use the key handle.
RegEnumKey, RegEnumKeyEx, RegEnumValue, RegQueryInfoKey, RegQueryValue, RegQueryValueEx