简体   繁体   中英

WinCE registry value monitor

Evening all,

I need some advice on monitoring a registry value in WinCE. I am writing a Windows Forms application which needs to monitor a value in registry, and fire an event when it changes, can anyone point me in the right direction as to how to accomplish this?

Many thanks in advance.

I managed to implement this using PInvoke code:

   [DllImport("coredll.dll", SetLastError = true)]
    static extern int RegOpenKeyEx(UIntPtr hKey, string lpSubKey, uint ulOptions, int samDesired, out UIntPtr phkResult);

    [DllImport("coredll.dll", SetLastError = true)]
    static extern UIntPtr CeFindFirstRegChange(UIntPtr hKey, [In, MarshalAs(UnmanagedType.Bool)] bool bWatchSubtree, uint dwNotifyFilter);

    [DllImport("coredll.dll", SetLastError = true)]
    public static extern UInt32 WaitForSingleObject(UIntPtr Handle, UInt32 Wait);

    [DllImport("coredll.dll", SetLastError = true)]
    static extern Int32 CeFindNextRegChange(UIntPtr hChangeHandle);

    [DllImport("coredll.dll", SetLastError = true)]
    static extern Int32 CeFindCloseRegChange(UIntPtr hChangeHandle);

    [DllImport("coredll.dll", SetLastError = true)]
    public static extern int RegCloseKey(UIntPtr hKey);

and by using WaitForSingleObject.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM