如何检测windows下是否安装了某个软件?

发布于 2024-11-29 04:07:34 字数 160 浏览 0 评论 0原文

我是编程新手。我获得了一个虚拟会议站点。现在我需要修改网站。

当用户登录到会议站点时,它必须检测他的系统中是否安装了特定的软件(该软件用于进行视频通话。它使用ActiveX对象)。

检测系统中是否存在已安装软件的最佳方法是什么? (坦白说,我什至不知道哪种语言最能达到目的)

I am new to programming. I've been given a virtual conferencing site. Now i need to modify the site.

While the user logins into the conferencing site,it must detect whether his system has a particular software installed in his system(that software is used for making video calls.It uses ActiveX objects).

Which is the best method to detect the presence of the installed software in the system? (Frankly speaking i don't even know which language best serves the purpose)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

戒ㄋ 2024-12-06 04:07:35

您无法真正检测到这一点,因为您无权访问系统。您的 Web 应用程序应该简单地尝试创建该 ActiveX 的实例,并在失败时向用户显示一条消息。

You can't really detect this as you have no access to the system. Your web app should simply try to create an instance of that ActiveX and display a message to the user if that fails.

坏尐絯℡ 2024-12-06 04:07:35
    public static bool IsApplictionInstalled(string p_name)
{
    string keyName;

    // search in: CurrentUser
    keyName = @"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall";
    if (ExistsInSubKey(Registry.CurrentUser, keyName, "DisplayName", p_name) == true)
    {
        return true;
    }

    // search in: LocalMachine_32
    keyName = @"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall";
    if (ExistsInSubKey(Registry.LocalMachine, keyName, "DisplayName", p_name) == true)
    {
        return true;
    }

    // search in: LocalMachine_64
    keyName = @"SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall";
    if (ExistsInSubKey(Registry.LocalMachine, keyName, "DisplayName", p_name) == true)
    {
        return true;
    }

    return false;
}

private static bool ExistsInSubKey(RegistryKey p_root, string p_subKeyName, string p_attributeName, string p_name)
{
    RegistryKey subkey;
    string displayName;

    using (RegistryKey key = p_root.OpenSubKey(p_subKeyName))
    {
        if (key != null)
        {
            foreach (string kn in key.GetSubKeyNames())
            {
                using (subkey = key.OpenSubKey(kn))
                {
                    displayName = subkey.GetValue(p_attributeName) as string;
                    if (p_name.Equals(displayName, StringComparison.OrdinalIgnoreCase) == true)
                    {
                        return true;
                    }
                }
            }
        }
    }
    return false;
}
    public static bool IsApplictionInstalled(string p_name)
{
    string keyName;

    // search in: CurrentUser
    keyName = @"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall";
    if (ExistsInSubKey(Registry.CurrentUser, keyName, "DisplayName", p_name) == true)
    {
        return true;
    }

    // search in: LocalMachine_32
    keyName = @"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall";
    if (ExistsInSubKey(Registry.LocalMachine, keyName, "DisplayName", p_name) == true)
    {
        return true;
    }

    // search in: LocalMachine_64
    keyName = @"SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall";
    if (ExistsInSubKey(Registry.LocalMachine, keyName, "DisplayName", p_name) == true)
    {
        return true;
    }

    return false;
}

private static bool ExistsInSubKey(RegistryKey p_root, string p_subKeyName, string p_attributeName, string p_name)
{
    RegistryKey subkey;
    string displayName;

    using (RegistryKey key = p_root.OpenSubKey(p_subKeyName))
    {
        if (key != null)
        {
            foreach (string kn in key.GetSubKeyNames())
            {
                using (subkey = key.OpenSubKey(kn))
                {
                    displayName = subkey.GetValue(p_attributeName) as string;
                    if (p_name.Equals(displayName, StringComparison.OrdinalIgnoreCase) == true)
                    {
                        return true;
                    }
                }
            }
        }
    }
    return false;
}
浮云落日 2024-12-06 04:07:35

谢谢大家。但我在 C# 中使用了这个程序。我创建了这个类库,在网页中加载了dll并使用IsApplicationInstalled方法。

public static bool IsApplicationInstalled(string p_name)
{
string displayName;
RegistryKey key;

// search in: CurrentUser
key = Registry.CurrentUser.OpenSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall");
foreach (String keyName in key.GetSubKeyNames())
{
    RegistryKey subkey = key.OpenSubKey(keyName);
    displayName = subkey.GetValue("DisplayName") as string;
    if (p_name.Equals(displayName, StringComparison.OrdinalIgnoreCase) == true)
    {
        return true;
    }
}

// search in: LocalMachine_32
key = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall");
foreach (String keyName in key.GetSubKeyNames())
{
    RegistryKey subkey = key.OpenSubKey(keyName);
    displayName = subkey.GetValue("DisplayName") as string;
    if (p_name.Equals(displayName, StringComparison.OrdinalIgnoreCase) == true)
    {
        return true;
    }
}

// search in: LocalMachine_64
key = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall");
foreach (String keyName in key.GetSubKeyNames())
{
    RegistryKey subkey = key.OpenSubKey(keyName);
    displayName = subkey.GetValue("DisplayName") as string;
    if (p_name.Equals(displayName, StringComparison.OrdinalIgnoreCase) == true)
    {
        return true;
    }
}
// NOT FOUND
return false;

}

Thanks everyone. But i used this program in C#. I created this class library ,loaded the dll in the webpage and use the IsApplicationInstalled method.

public static bool IsApplicationInstalled(string p_name)
{
string displayName;
RegistryKey key;

// search in: CurrentUser
key = Registry.CurrentUser.OpenSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall");
foreach (String keyName in key.GetSubKeyNames())
{
    RegistryKey subkey = key.OpenSubKey(keyName);
    displayName = subkey.GetValue("DisplayName") as string;
    if (p_name.Equals(displayName, StringComparison.OrdinalIgnoreCase) == true)
    {
        return true;
    }
}

// search in: LocalMachine_32
key = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall");
foreach (String keyName in key.GetSubKeyNames())
{
    RegistryKey subkey = key.OpenSubKey(keyName);
    displayName = subkey.GetValue("DisplayName") as string;
    if (p_name.Equals(displayName, StringComparison.OrdinalIgnoreCase) == true)
    {
        return true;
    }
}

// search in: LocalMachine_64
key = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall");
foreach (String keyName in key.GetSubKeyNames())
{
    RegistryKey subkey = key.OpenSubKey(keyName);
    displayName = subkey.GetValue("DisplayName") as string;
    if (p_name.Equals(displayName, StringComparison.OrdinalIgnoreCase) == true)
    {
        return true;
    }
}
// NOT FOUND
return false;

}

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文