What is the best/most reliable way of detecting if a PC has Microsoft ActiveSync installed? My PC program uses RAPI to get files off of the device and if it isn't installed there is an error that RAPI.dll cannot be found.
+2
A:
Why don't you just do what you're already doing and trap the "RAPI.dll not found" exception that you get and display a message to the user to install activesync?
Hardwareguy
2009-06-23 13:50:00
+3
A:
You can read the registry to detect if ActiveSync is installed
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows CE Services
Jorge
2009-06-23 14:11:53
suuuuure.... if you wanna do it the "right" way +1
Hardwareguy
2009-06-23 14:20:50
A:
/// <summary>
/// Checks to see if ActiveSync/Windows Mobile Device Center
/// is installed on the PC.
/// </summary>
/// <param name="syncVersion">The version of the synchronization tool installed.</param>
/// <returns>True: Either ActiveSync or Windows Mobile Device Center is
/// installed. False: version is null
/// </returns>
private static bool isActiveSyncInstalled(out Version syncVersion)
{
using (RegistryKey reg =
Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\Windows CE Services"))
{
if (reg == null)
{
syncVersion = null;
return false;
}
int majorVersion = (int)reg.GetValue("MajorVersion", 0);
int minorVersion = (int)reg.GetValue("MinorVersion", 0);
int buildNumber = (int)reg.GetValue("BuildNumber", 0);
syncVersion = new Version(majorVersion, minorVersion, buildNumber);
}
return true;
}
0A0D
2009-11-30 18:01:35