Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Detect if Ax control exists, and redirect if it doesn't?

Status
Not open for further replies.

ozjimbob

Programmer
Aug 19, 2001
1
AU
I'm pretty hopeless at client-side VBscript, I mainly do ASP...so I'm looking for a way to detect if a certain ActiveX control ("RXHIGHX.RxhighxCtrl.1") exists on the client's computer, and if not, redirect to a page where the component can be downloaded. I've been trying to simply open the component, then location.replace if there's an error, but it doesn't seem to be working.
 
hi,ozjimbob

try this...

<SCRIPT LANGUAGE=&quot;VBScript&quot;>
Dim ACTX

SUB Window_OnLoad()
ACTX = &quot;UNKNOWN&quot;

FindActiveX()

IF ACTX = &quot;NOT INSTALLED&quot; THEN
your not installed code
ELSE
your installed code
END IF
END SUB

SUB FindActiveX()
On Error Resume Next

IF NOT IsObjectCreateObject&quot;RXHIGHX.RxhighxCtrl.1&quot;)))
THEN
'*** REALLY DO NOTHING ***
ELSE
ACTX = &quot;INSTALLED&quot;
END IF

IF ACTX = &quot;UNKNOWN&quot; THEN
ACTX = &quot;NOT INSTALLED&quot;
END IF
END SUB
</SCRIPT>

enjoy
 
SUB Window_OnLoad()

Set myobj = FindActiveX(&quot;RXHIGHX.RxhighxCtrl&quot;)
if MyObj is Nothing then
your not installed code
ELSE
your installed code
END IF
END SUB

Function FindActiveX(strObject)
Dim objTest
Set objTest = Nothing ' Make object in case fail
On Error Resume Next
Set objTest = CreateObject(strObject)
On Error goto 0
Set FindActiveX = objTest
Set objTest = Nothing
END SUB
Compare Code (Text)
Generate Sort in VB or VBScript
 
Hey OZJIMBOB,

There is an error in the second line of sub FindActiveX().
The correct is :

[color]redIF NOT (IsObject(CreateObject(&quot;RXHIGHX.RxhighxCtrl.1&quot;))) THEN

sorry for the mistake.
 
Hey OZJIMBOB,

There is an error in the second line of sub FindActiveX().
The correct is :


IF NOT (IsObject(CreateObject(&quot;RXHIGHX.RxhighxCtrl.1&quot;))) THEN

sorry for the mistake.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top