检查是否安装了Skype

5 c# skype

我试图修复一种方法,检查用户是否在他的计算机上安装了Skype.这个我修复/提出:

  1. 我的电脑上安装了Skype
  2. 我修复了一个遍历所有已安装程序的方法
  3. 我的方法找到我安装的程序但是虽然安装了它但找不到Skype.但是我的方法找到了同一目录中的其他程序.

有没有人对如何检查计算机上是否安装了Skype有任何想法?

我使用的方法是这个方法的simillrar:

循环遍历所有已安装程序的方法

Rei*_*ldo 6

只需使用注册表:

using Microsoft.Win32;

    //Function uses Microsoft.Win32 to check registry value of
    //HKEY_CURRENT_USERSoftwareSkypePhoneSkypePath and returns false if
    //the key is null
    private bool isSkypeUser()
    {
        RegistryKey skype = Registry.CurrentUser.OpenSubKey(@"SoftwareSkypePhone");

        if (skype != null && skype.GetValue("SkypePath") != null)
        {
            return true;
        }
        else
        {
            return false;
        }
    }
Run Code Online (Sandbox Code Playgroud)

http://brcline.com/blog/?tag=skype

编辑:

一个肮脏的解决方法是遍历StartMenu文件夹,查找Skype快捷方式或文件夹.您必须使用以下SpecialFolder枚举:

var startMenuPath = Environment.GetFolderPath(Environment.SpecialFolder.CommonPrograms)
Run Code Online (Sandbox Code Playgroud)

希望能帮助到你!