示例#1
0
    private static void CheckWindowsMediaSharingService()
    {
      const string keyPath = "SYSTEM\\CurrentControlSet\\Services\\WMPNetworkSvc";
      RegistryKey key = Registry.LocalMachine.OpenSubKey(keyPath);

      if (key != null)
      {
        string strUninstall = key.GetValue("Start").ToString();
        key.Close();
        switch (strUninstall)
        {
          case "1":
            _wmpServices = WmpServiceStatus.StartupAutomatic;
            break;
          case "2":
            _wmpServices = WmpServiceStatus.StartupManual;
            break;
          case "4":
            _wmpServices = WmpServiceStatus.StartupDisabled;
            break;
        }
      }
      else
      {
        _wmpServices = WmpServiceStatus.NotInstalled;
      }
    }