private static extern int _RegNotifyChangeKeyValue( SafeHandle hKey, bool bWatchSubtree, RegNotifyChange dwNotifyFilter, SafeHandle hEvent, bool fAsynchronous );
private static extern int RegNotifyChangeKeyValue( IntPtr hKey, bool watchSubtree, RegNotifyChange notifyFilter, IntPtr hEvent, bool asynchronous );
public static void RegNotifyChangeKeyValue( RegistryKey key, WaitHandle notifyEvent, bool recursive = false, RegNotifyChange filter = RegNotifyChange.Value ) { int error = _RegNotifyChangeKeyValue( key.Handle, recursive, filter, notifyEvent.SafeWaitHandle, true); if (error != 0) { throw new Win32Exception(error); } }
public RegistryChangeMonitor(string registryPath, RegNotifyChange filter) { _registryPath = registryPath.ToUpper(); _filter = filter; }