Accessibility
 
Home > Products > Authorware > Support > Using ActiveX controls
Macromedia Authorware Support Center - Using ActiveX controls
Sample scripts

Installing from the Internet

-- This checks for the existence of ActiveX support.

if ActiveXInstalled() = 0 then

MB_Caption:="ActiveX Support Missing"

MB_BodyText:="You do not have the necessary ActiveX support files installed.¬

Please run the installation routine included with this program."

MB_BoxNumber:=16

MB_ReturnedValue:=MessageBox(WindowHandle,MB_BodyText,MB_Caption,¬
MB_BoxNumber)

else



-- This is the ID of the control to register, you can get the ID by clicking

-- Options and URL from the Sprite Icon Properties dialog box.

ControlID:= "{FC25B780-75BE-11CF-8B01-444553540000}"



-- Checks security settings to see if we can download controls.

MB_ReturnedValue:=6

repeat while (ActiveXDownloadSetting()="Disabled" |¬
ActiveXSecuritySetting()="High") & MB_ReturnedValue=6

MB_Caption:="ActiveX Security Settings"

MB_BodyText:="Your ActiveX Security settings may prevent this application ¬
from installing an ActiveX control. You must enable ActiveX downloading ¬
and set the Security Method to Medium or None. Would you like to change ¬
your settings now?"

MB_BoxNumber:=36

MB_ReturnedValue:=MessageBox(WindowHandle,MB_BodyText,MB_Caption,¬
MB_BoxNumber)

if MB_ReturnedValue=6 then

ActiveXSecurityDialog()

end if

end repeat





-- Check to see if we can install now. 
--If not, display a warning, otherwise install the control.

If ActiveXDownloadSetting()="Disabled" | ActiveXSecuritySetting()="High" then

MB_Caption:="Unable to Download Control"

MB_BodyText:="Your ActiveX Security settings prevented the installation of ¬
an ActiveX control that this application needs."

MB_BoxNumber:=16

MB_ReturnedValue:=MessageBox(WindowHandle,MB_BodyText,MB_Caption, ¬
MB_BoxNumber)

else

-- Call the download and register function of the control. Installs only a later version.

ActiveXControlDownload(ControlID, ¬
"http:////www.macromedia.com//support//authorware//",-1,-1,-1,-1)

end if

end if
Installing from a local source
-- This is the ID of the control to register, you can get the ID by clicking

-- Options and URL from the Sprite Icon Properties dialog box.

ControlID:= "{FC25B780-75BE-11CF-8B01-444553540000}"



-- This checks for the existence of ActiveX support.

if ActiveXInstalled() = 0 then

MB_Caption:="ActiveX Support Missing"

MB_BodyText:="You do not have the necessary ActiveX support files installed.¬
Please run the installation routine included with this program."

MB_BoxNumber:=16

MB_ReturnedValue:=MessageBox(WindowHandle,MB_BodyText,MB_Caption,¬
MB_BoxNumber)

else

-- Checks for to see if the control is already registered, if not it registers the local file.

if ActiveXControlQuery(ControlID) = 0 then

ControlInstalled:=ActiveXControlRegister(FileLocation^"mycontrol.ocx")

end if 
end if



-- Once you're finished using a control, you can unregister it.

if ControlInstalled = -1 then

ActiveXControlUnregister(FileLocation^"mycontrol.ocx")

end if
To Table of Contents Back to previous page