Pregunta

¿Cuál es la mejor / más confiable forma de detectar si una PC tiene instalado Microsoft ActiveSync? El programa de mi PC utiliza RAPI para quitar archivos del dispositivo y, si no está instalado, hay un error de que no se puede encontrar RAPI.dll.

¿Fue útil?

Solución

Puede leer el registro para detectar si ActiveSync está instalado

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows CE Services 

Otros consejos

/// <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;
}

También puede verificar si
C: \ Windows \ System32 \ rapi.dll existe
¿Has intentado incluir el archivo rapi.dll con tu aplicación?

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top