次の方法で共有


Detecting ActiveSync State

Send Feedback

Applications can determine if a device is currently cradled and if syncronization is currently in progress by querying the following registry values that are maintained by the ActiveSync application.

HKLM\System\State\ActiveSync\Cradled

HKLM\System\State\ActiveSync\Synchronizing

Both of these are DWORD values. They are nonzero if the condition is true and zero if the condition is false.

Code Example

The following example shows how to determine whether a device is cradled or synchronizing.

BOOL IsCradled()
{
    DWORD dwCradled = 0;
    RegistryGetDWORD(HKEY_LOCAL_MACHINE, TEXT("System\\State\\Hardware"), TEXT("Cradled"), &dwCradled);
    return dwCradled;
}

BOOL IsSynchronizing()
{
    DWORD dwSynchronizing = 0;
    RegistryGetDWORD(HKEY_LOCAL_MACHINE, TEXT("System\\State\\ActiveSync"), TEXT("Synchronizing"), &dwSynchronizing);
    return dwSynchronizing;
}

These examples use the RegistryGetDWORD method to obtain the registry values. For more information on this and other methods for determining the current state of a device, see State and Notifications Broker.

See Also

Handling Connection Notification | State and Notifications Broker

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.