Comment détecter si Microsoft ActiveSync est installé sur un PC
-
06-07-2019 - |
Question
Quel est le meilleur moyen / le plus fiable de détecter si Microsoft ActiveSync est installé sur un PC? Le programme de mon ordinateur utilise RAPI pour extraire des fichiers de l’appareil. Si ce n’est pas le cas, RAPI.dll ne peut pas être trouvé.
La solution
Vous pouvez lire le registre pour détecter si ActiveSync est installé
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows CE Services
Autres conseils
/// <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;
}
Vous pouvez également vérifier si
C: \ Windows \ System32 \ rapi.dll existe
Avez-vous essayé d'inclure le fichier rapi.dll dans votre application?
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow