如何以编程方式确定是否已安装ActiveX控件,以及是否已禁用ActiveX控件或整个ActiveX? [英] How do I programmatically determine if an ActiveX control has been installed, and whether it or ActiveX as a whole has been disabled?

查看:103
本文介绍了如何以编程方式确定是否已安装ActiveX控件,以及是否已禁用ActiveX控件或整个ActiveX?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在服务器端使用ASP.NET,在客户端使用JavaScript。

I'm using ASP.NET on the server side and JavaScript on the client side.

我正在尝试开发一些页面来帮助用户进行故障排除并且我想知道是否可以通过编程方式确定以下内容:

I'm trying to develop some pages that will help the user troubleshoot and I was wondering if there was a way to programmatically determine the following:


  1. 如果Internet Explorer中的ActiveX已被禁用

  2. 如果已安装ActiveX控件

  3. 如果已安装但禁用了ActiveX控件

对于情况2和3,我知道为了检测到已安装ActiveX控件,您可以在JavaScript中使用以下检查:

For cases 2 and 3, I know that in order to detect that an ActiveX control is installed, you would use the following check in JavaScript:

function isActiveXControlInstalled(progId, expectedVersion)
{
    var version;
    try
    {
        var instance = new ActiveXObject(progId);
        version = instance.VersionString;
        instance = null;
    }
    catch (e)
    {
       version = null; // Set version to null, since that is an invalid control version, and the check below will always fail.
    }

    return (version >= expectedVersion);
}

但是,在安装了控件的情况下,此函数也返回false禁用的。可以区分这两种情况吗?

However, this function also returns false in the case that the control is installed but disabled. Can these two cases be distinguished?

推荐答案

否。我认为,如果已安装但已禁用,则无法从应用程序中得知。您可以考虑将疑难解答页面中的措词更改为未安装或已禁用。

No. I think if it is installed but disabled you won't be able to tell from your application. You might consider changing the wording in your troubleshooting page to "not installed or is disabled".

这篇关于如何以编程方式确定是否已安装ActiveX控件,以及是否已禁用ActiveX控件或整个ActiveX?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆