2 out of 3 rated this helpful - Rate this topic

RegistryState Class

Windows Mobile 6.5
3/29/2010

Defines the state of a registry key (that is, the key name, the names of its values, and the data contained in its values).

Namespace: Microsoft.WindowsMobile.Status
Assembly: Microsoft.WindowsMobile.Status (in microsoft.windowsmobile.status.dll)
public class RegistryState : StateBase, IDisposable

When defining an instance of RegistryState that is going to handle the Changed event, make sure that the instance is defined globally in the class where the event will be handled. If it is defined in a method, it will be up for garbage collection after it goes out of scope.

public class MyClass
{
    RegistryState state; // defined globally to class
    private void Form1_Load(object sender, EventArgs e)
    {
        // SystemState state;  // This instance will go out of scope if defined here

        RegistryState state = new RegistryState("HKEY_LOCAL_MACHINE\\MyKey", "MyValue");
        state.Changed += new ChangeEventHandler(state_Changed);
    }
}

System.Object
   Microsoft.WindowsMobile.Status.StateBase
    Microsoft.WindowsMobile.Status.RegistryState
Any public static (Shared in Visual Basic) members of this type are thread-safe. Any instance members are not guaranteed to be thread-safe.
Did you find this helpful?
(1500 characters remaining)
© 2013 Microsoft. All rights reserved.