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.
Asked
Active
Viewed 3,049 times
3 Answers
7
/// <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;
}
4
You can read the registry to detect if ActiveSync is installed
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows CE Services

Jorge Zuanon
- 1,284
- 10
- 11
-
1Warning: This registry entry persists when ActiveSync is uninstalled. So you get a false positive on machines where CE had been installed but now has been removed. Check for the existance of a value name in that key (for instance: the values "InstalledDir"/"BuildNumber"/"MajorVersion"/... should exist inside that registry key) – Felix Alcala Sep 14 '11 at 13:50
-
@FelixAlcala: Yep, that's what my answer checks for – Mar 26 '13 at 17:20
0
You can also check if
C:\Windows\System32\rapi.dll exists
Have you tried to include rapi.dll file with your application ?

mr R
- 997
- 2
- 12
- 25