CeFindFirstRegChange
Windows Mobile SupportedWindows Embedded CE Supported
8/28/2008

This function creates a change notification handle and sets up initial change notification filter conditions. A wait on a notification handle succeeds when a change matching the filter conditions occurs in the specified registry key or subkeys.

Syntax


HANDLE CeFindFirstRegChange (
  HKEY hKey,
  BOOL bWatchSubtree,
  DWORD dwNotifyFilter
);
Parameters

hKey

[in] Handle to an open key. This handle is returned by the RegCreateKeyEx or the RegOpenKeyEx function, or it can be set to one of the following predefined keys:

  • HKEY_CLASSES_ROOT
  • HKEY_CURRENT_CONFIG
  • HKEY_CURRENT_USER
  • HKEY_LOCAL_MACHINE
  • HKEY_USERS
bWatchSubtree

[in] If this parameter is set to TRUE, the function reports changes in the specified key and its subkeys. If the parameter is set to FALSE, the function reports changes only in the specified key.

dwNotifyFilter

[in] Changes to be reported. This following table shows possible values.

Value Description

REG_NOTIFY_CHANGE_LAST_SET

Notify the caller of changes to a value of the key. This can include adding or deleting a value or changing an existing value.

REG_NOTIFY_CHANGE_NAME

Notify the caller if a subkey is added or deleted.

Return Value

A handle to a find change notification object indicates success. INVALID_HANDLE_VALUE indicates failure. To get extended error information, call GetLastError.

Requirements

Headerwinreg.h
Librarycoredll.lib
Windows Embedded CEWindows CE 5.0 and later
Windows MobileWindows Mobile Version 5.0 and later
See Also

Reference

Registry Notification Functions
RegCreateKeyEx
RegOpenKeyEx

Other Resources

State and Notifications Broker

Tags :


Community Content

spandith
Usage example
  

A small usage example:
dwResult = RegOpenKeyEx(HKEY_CURRENT_USER, DESIRED_REGKEY, 0, KEY_NOTIFY, &hKey);
if(ERROR_SUCCESS != dwResult)
{
//Do error handling
}
// Request notification of registry changes:
hEventRegistryChange = CeFindFirstRegChange(hKey, FALSE, REG_NOTIFY_CHANGE_LAST_SET);
if(INVALID_HANDLE_VALUE == hEventRegistryChange)
{
//handle error
}
RegCloseKey(hKey);


Later:
if (WAIT_TIMEOUT != WaitForSingleObjects(hEventRegistryChange, FALSE, INFINITE))
{
//Do a better checking above

// Tell the OS to notify of the next change as well
CeFindNextRegChange(hEventRegistryChange);
//Handle the change
}

Tags :

Page view tracker