ActiveX Allowed or Not

I have a control that uses activeX, but is not completely activeX. dont ask how just believe me.

I want to be able to determine if the user has disabled activeX so i can prevent my control from running.

if activeX is disabled or dis-allowed then the control will start its job and not finish, so i would rather just not start it.

does anyone know of a way to check this?
Joshua SpragueAsked:
Who is Participating?
I found this here:

<script language=vbscript>
    function checkActiveX()
        dim myDict

        on error resume next

        set myDict = CreateObject("Scripting.Dictionary")

        myDict.Add "test", "test"

        if Err.number > 0 then
            gErrorNo = Err.number
            checkActiveX = false
        else // succeeded
            set myDict = nothing
            checkActiveX = true
        end if
    end function

Joshua SpragueAuthor Commented:
i tested the page that you found it on, and that is EXACTLY what i want. unfortunately, the pages i need it on are in C#. could you please tell me how to do this in c#?
new point value is : 100

thank you
I'm sorry but I don't know C#, but I'll bet somone here does:

You could either open a new question in that area or create a pointer question that links to this question and hope that someone from that area comes over to help.  Or, keep this thread open for a while and maybe someone else will see this question who can help convert it.
Joshua SpragueAuthor Commented:
thanx, i figured it out. i based my code on what you showed me.
i used vbscript / javascript.
here is what i did.

VBScript Function:

' Function ActiveXEnabled
function activexenabled()
  on error resume next
  activex = (NOT IsNull(CreateObject("ScriptBridge.ScriptBridge")))
  activex2 = (NOT IsNull(CreateObject("MSComctlLib.Slider")))
  activex3 = (NOT IsNull(CreateObject("ScriptBridge.ScriptBridge.1")))
  if (activex OR activex2 OR activex3) then
      activexenabled = true
      activexenabled = false
  end if
end function

I used javascript to call the function and test for ActiveX being enabled / disabled.

If it was disabled, i used the javascript     document.writeln     to comment out the ActiveX control.

works perfectly.

thank you.
Cool.  That looks like a nice adaptation.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.