2009-06-23 132 views

回答

4

可以讀取註冊表來檢測的ActiveSync安裝

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows CE Services 
+0

suuuuure ....如果你想這樣做的「正確」的方式+1 – Hardwareguy 2009-06-23 14:20:50

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

您還可以檢查是否
C:\ WINDOWS \ SYSTEM32 \文件Rapi.dll存在
你試過在應用程序中包含rapi.dll文件?

相關問題