Activate ActiveX Control

Source: Internet
Author: User
Tags activex update

ActiveX control activation date released: 2006-3-29 | Updated on: 2006-3-29

Internet Development Index

You cannot directly interact with Microsoft ActiveX controls loaded with applet, embed, or object elements. You can interact with these controls only after activating the user interface of these controls. This article describes how Microsoft Internet Explorer handles ActiveX controls and shows how to load ActiveX controls to activate their interfaces. It also describes the application of this behavior to auxiliary tools and the webbrowser control of the host.Program.

This topic contains the following parts.

Content on this page

Understand control activation
Externally loaded interactive controls
Programmatically determine whether the control is not activated
Secondary Impact
Influence of webbrowser Control
Appendix A: DHTML events blocked by inactive controls

For more information about the platform affected by this update, see Internet Explorer ActiveX update.

Understand control activation

Interactive controlsIs an ActiveX control that provides a user interface. When the web page is usedApplet,EmbedOrObjectWhen an ActiveX control is loaded to an element, the user interface of the control is blocked until the user activates it. If a page uses these elements to load multiple controls, each interactive control must be activated independently.

If a widget is not activated, the following results are displayed.

User interaction-relatedDynamicHTML (DHTML)Event(Such as onblur and onclick) are blocked. Appendix A lists DHTML events that are blocked when the control is not activated.

This control does not respond to window messages generated by the keyboard or mouse, such as wm_click and wm_keypress.

Overwrite the window (the OLE site created for the Control) to prevent the keyboard and mouse messages from reaching the inactive control.

After an inactive control is created, Internet Explorer uses different technologies to prevent messages in the keyboard or mouse window from reaching the control. If the inactive control is a window control (such as the HTML Help Control), Internet Explorer usesEnablewindowFunctionDisable the window of the inactive control. When a user activates a window control, the function activates the disabled window. If the inactive control is a windowless control (such as an office Web component), the container of the control filters keyboard and mouse messages.

If a control is not activated, it does not respond to user input but performs operations unrelated to interaction. For example, if you open a Web page that uses a Microsoft Windows Media Player to play a music file, the page is loaded before playing music. You can interact with the Windows Media Player only after the user interface of the control is activated, as shown in.

NoteAlthough the inactive controls do not respond to any direct user interaction, they respond to script commands.

To activate an interactive control, you can click the control or use the tab key to set the focus on the control, and then press the spacebar or enter key. Interactive controls loaded from external scripts can immediately respond to user interaction without activation.

Some controls with Windows use Windows API functions (such as getkeystate and getcursorpos) to determine the keyboard and mouse states and then respond to the function results. For these controls only, a prompt is displayed before the control is run in Internet Explorer. To run the control, you must click the button in the message window before loading the page. After the widget is loaded, it does not need to be activated. Currently, the following controls have this behavior, but the supplier is continuing to develop new controls that do not have this behavior.

Virtoolsweb player from virtools SA

Macromedia Shockwave playerfrom Adobe Systems Inc.

Quicktimefrom Apple Computer, Inc.

When loading from an external script file, these controls do not display a prompt.

The prompt dialog box is displayed.

Back to Top

Externally loaded interactive controls

To create a web page that loads interactive controls (these controls immediately respond to user input), use Microsoft JScript to load controls from external script files. You cannot write script elements inline with the main HTML page to load controls from the outside. For exampleWritelnFunction), the loaded control is the same as that loaded by the HTML document itself, and needs to be activated. To ensure that the control is interactive after being loaded, use any of the following technologies.

The following example usesDocument. WriteDynamically load controls.

 
// Html file <HTML> <body leftmargin = 0 topmargin = 0 scroll = NO> <SCRIPT src = "embed. JS "> </SCRIPT> </body>  

The external script file can also modifyOuterhtmlProperties to achieve the same effect, as shown in the following example.

// Html file <HTML> <body> <div> <SCRIPT src = "embedcontrolouterhtml. JS "> </SCRIPT> </div> </body>  

Next exampleDocument.CreateelementLoad a usageObjectActiveX Control of the element.

ImportantWhen using createelement to load an object or EMBED element to a Web page, be careful to create this element, initialize its attributes, and add this element to the DOM of the page, then create the ActiveX control to be loaded by the new element. For more information, seeCreateelementDocumentation.

// Html file <HTML> <body> <Div id = "divid"> <SCRIPT src = "createelementexplicit. JS "> </SCRIPT> pre HTML> <body> // createelementexplicit. jsvar myobject = document. createelement ('object'); divid. appendchild (myobject); myobject. width = "200"; myobject. height = "100"; myobject. classid = "CLSID: 6bf52a52-394a-11d3-b153-00c04f79faa6"; myobject. url = "example. WMV "; myobject. uimode = "NONE ";

Next exampleInnerhtmlAnd JScript functions load ActiveX controls, and specify the parameter value.

// Html file <HTML>  
 
// External_script.jsfunction createcontrol (divid, CLSID, objectid, width, height, URL, autostart) {var d = document. getelementbyid (divid); D. innerhtml = '<object classid =' + CLSID + 'id = '+ objectid + 'width =' + width + 'height = '+ height +'> <Param name = "url "value = '+ URL +'> <Param name =" autostart "value = '+ autostart +'/> ';}

The following example usesWritelnThe function inserts the script into the original HTML document, so the generated control needs to be activated. To load a control that does not require activation, use one of the preceding examples.

// Html file <HTML> <body> <Div id = "embedcontrollocation"> <SCRIPT id = "elementid" src = "embedcontrol. JS "> </SCRIPT> </div> </body>  

WarningIf you do not select the disable script debugging (Internet Explorer) option on the "advanced" tab of "Internet Options" on the control panel, the controls created using these technologies still need to be activated.

Back to Top

Programmatically determine whether the control is not activated

You cannot use JScript functions or server scripts to determine whether a control is activated. The application that hosts the web browser control cannot determine whether a control is activated.

You can use the dispid_ambient_uidead environment attribute to determine the activation status.Idispatch: invokeCall. This property is passedIolecontrol: onambientpropertychangeThe implementation will be notified when changes are made.IolecontrolInterface Control.

Back to Top

Secondary Impact

When the auxiliary tool encounters an ActiveX control, you can useIaccessibleInterface to obtain information about the control. AvailableIaccessible: accdodefaultactionMethod to activate the inactive control.

The following table describes the calls to an inactive control.IaccessibleResult of the method.

Method Description

Iaccessible: accdodefaultaction

Activate the control and publish the ActiveX control or Java Applet in the msaa tree.

Iaccessible: acchittest

Returns childid_self.

Iaccessible: acclocation

Location of the underlying ActiveX control or Java Applet

Iaccessible: accnavigate

Returns e_notimpl.

Iaccessible: accselect

Returns e_notimpl.

Iaccessible: get_accchild

Returns s_false.

Iaccessible: get_accchildcount

Returns 0 and s_ OK.

Iaccessible: get_accdefaaction action

Return "select this control"

Iaccessible: get_accdescription

Returns e_notimpl.

Iaccessible: get_accfocus

Returns e_notimpl.

Iaccessible: get_acchelp

Return "this control is inactive. Select the control to activate and use it ."

Iaccessible: get_acchelptopic

No change-returns e_notimpl

Iaccessible: get_acckeyboardshortcut

No change-delegate this object. If no object exists, this method returns e_notimpl.

Iaccessible: get_accname

Return "inactive control"

Iaccessible: get_accparent

No change-returns the most recent accessible element in the parent chain.

Iaccessible: get_accrole

Returns role_system_pushbutton.

Iaccessible: get_accselection

Returns e_notimpl.

Iaccessible: get_accstate

Returns the current status of the object. This status always includes state_system_focusable

Iaccessible: get_accvalue

Returns e_notimpl.

Iaccessible: put_accname

Returns e_notimpl.

Iaccessible: put_accvalue

Returns e_notimpl.

For information about activated controls or controls that do not require activation, seeActive accessibility SDK.

NoteThe auxiliary tool should refresh the default operation to correctly display the ActiveX control data and its Child control data (if any ).

Back to Top

Influence of webbrowser Control

By default, the hostWebbrowser ControlThe Custom ApplicationApplet,EmbedOrObjectInteractive ActiveX Control loaded by elements. Inactive control blocks apply only to the following applications.

Windows Explorer

Internet Explorer

MSN Explorer

Aolexplorer

Aol8.0

Aol9.0

CompuServe 2000

Aim

Maxthon Browser

Netcaptor

Browse3d

Macromedia Dreamweaver

Macromedia contribute

Netscape8 (when Internet Explorer is used as a rendering engine)

To match the behavior of Internet Explorer in the application, add the dochostuiflag_enable_activex_inactivate_mode flagDochostuiinfoThe dwflags parameter of the structure is shown in the following example.

Hresult gethostinfo (dochostuiinfo * pinfo) {... pinfo-> cbsize = sizeof (dochostuiinfo); pinfo-> dwflags = {Other dochostuiflags} | response;... return s_ OK ;}

You can also enable interactive control blocking by adding the application process name to the following registry key.

 
HKEY_LOCAL_MACHINE (or HKEY_CURRENT_USER) softwaremicrosoftinternet assumermainfeaturecontrolfeature_enable_activex_inactivate_modeprocess_name.exe = (DWORD) 0x00000001

NoteBecause you can modify the registryDochostuiinfoFlag is the preferred method to enable interactive control blocking.

By default, applications can be registered to be incorporated into ActiveX controls for activation. For more information, contact your technical customer manager or Microsoft's Product Support Department.

Back to Top

Appendix A: DHTML events blocked by inactive controls

The following table lists DHTML events that are blocked when the ActiveX control is not activated.

Onactivate

Ondragleave

Onmouseout

Onbeforeactivate

Ondragover

Onmouseover

Onbeforecopy

Ondragstart

Onmouseup

Onbeforecut

Ondrop

Onmousewheel

Onbeforedeactivate

Onfocus

Onmove

Onbeforepaste

Onfocusin

Onmoveend

Onblur

Onfocusout

Onmovestart

Onclick

Onhelp

Onpage

Oncontextmenu

Onkeydown

Onpaste

Oncontrolselect

Onkeypress

Onresize

Oncopy

Onkeyup

Onresizeend

Oncut

Onlosecapture

Onresizestart

Ondblclick

Onmousedown

Onscroll

Ondeactivate

Onmouseenter

Onselectstart

Ondragend

Onmouseleave

-

Ondragenter

Onmousemove

-

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.