How do I programmatically determine if an ActiveX control has been installed, and whether it or ActiveX as a whole has been disabled?

爱⌒轻易说出口 提交于 2019-12-11 03:28:12

问题


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. if ActiveX has been disabled in Internet Explorer
  2. if an ActiveX control has been installed
  3. if an ActiveX control has been installed but disabled

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

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


回答1:


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".



来源:https://stackoverflow.com/questions/1424081/how-do-i-programmatically-determine-if-an-activex-control-has-been-installed-an

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!