Activate ActiveX Control

Source: Internet
Author: User
Tags activex update

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 topic describes how Microsoft Internet Explorer Processes ActiveX controls, displays the interface for loading ActiveX controls to activate them, and describes the impact of this behavior on auxiliary tools and applications hosting webbrowser controls. (This article also contains links to English webpages .)

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
Assistance impact
Influence of webbrowser Control
Appendix A: DHTML events blocked by inactive controls

For more information about user experience, see Internet Explorer 6: ActiveX update.

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

Understand control activation

Interactive controls are ActiveX controls that provide user interfaces. When a webpage loads an ActiveX control using an applet, embed, or object element, the user interface of the control is blocked until the user activates it. If the page uses the preceding element to load multiple controls, each interactive control must be activated separately.

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

Dynamic HTML (DHTML) events (such as onblur and onclick) related to user interaction are blocked ). Appendix A lists DHTML events that are blocked when the control is not activated.

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

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

When creating an inactive control, Internet Explorer uses different technologies to prevent messages from reaching the control on the keyboard or mouse window. If the unactivated control has a window control (such as the HTML Help Control), Internet Explorer uses the enablewindow function to disable the window of the unactivated control. When a user activates a control with a window, 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.

When the control is not activated, it does not respond to user input; however, it does perform interactive unrelated operations. For example, if you open a webpage that uses a Microsoft Windows Media Player to play a music file, the page is loaded to play the music. You cannot interact with the Windows Media Player before activating the user interface of the control, as shown in.

Note:: Unactivated controls do not respond to direct user interaction, but they respond to script commands.

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

Some window controls 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.

Virtools (TM) Web player of virtools SA

Adobe Systems Inc.'s Macromedia Shockwave Player (TM)

QuickTime (TM) of 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 webpage that loads an interactive control (responds immediately to user input), use Microsoft JScript to load the control from an external script file. You cannot write script elements inline with the main HTML page to load controls from the outside. If the script is programmed in an inline way (for example, using the writeln function), 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 when it is loaded, use one of the following methods to load the control from an external file.

The following example uses document. Write to dynamically load controls.

<! -- HTML file --> <HTML> <body leftmargin = 0 topmargin = 0 scroll = NO> <SCRIPT src = "docwrite. JS "> </SCRIPT> </body> 

An external script file can also modify the element's outerhtml attribute to achieve the same effect, as shown in the following example.

<! -- HTML file --> <HTML> <body> <Div id = "embedcontrollocation"> <SCRIPT src = "embedcontrolouterhtml. JS "> </SCRIPT> </div> </body> 

The following example uses document. createelement to load ActiveX controls that use object elements.

Note:: When Using createelement to load an object or EMBED element to a webpage, 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, see the createelement document.

<! -- HTML file --> <HTML> <body> <Div id = "divid"> <SCRIPT src = "createelementexplicit. JS "> </SCRIPT> </div> </body> 

The following example uses the innerhtml and JScript functions to load ActiveX controls and specify the parameter values.

<! -- HTML file --> <HTML> 

Because the following example uses the writeln function to insert the script into the original HTML document, 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>

Note:: To automatically activate ActiveX controls, Internet Explorer must use VBscript. dll and jscript. dll versions after January 1, September 30, 2003. In earlier versions of this DLL, all controls need to be activated, regardless of the mechanism for loading them from webpages. For the current versions of VBScript. dll and jscript. dll libraries, see Download Windows Script.

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. Applications hosting web browser controls cannot determine whether the controls are activated.

You can use the dispid_ambient_uidead environment attribute to determine the activation status. This attribute is called through idispatch: invoke. When this attribute is changed through iolecontrol: onambientpropertychange, The iolecontrol interface is notified.

Back to Top

Assistance impact

When a helper tool encounters ActiveX controls, they can use the iaccessible interface of the object to obtain information about the controls. Inactive controls can be activated using the iaccessible: accdodefaultaction method.

The following table describes the results of calling the iaccessible Method on an inactive control.

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

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

Iaccessible: get_accname

Return "inactive control"

Iaccessible: get_accparent

Unchanged-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 activating controls or controls that do not require activation, see active accessibility SDK.

Note:: The auxiliary tool should refresh the default operation after triggering, so that the ActiveX control data and its subitem data can be correctly displayed (if any ).

Back to Top

Influence of webbrowser Control

By default, custom applications hosting the webbrowser control do not block ActiveX controls loaded by the applet, embed, or object element. Inactive control blocks apply only to the following applications.

Windows Explorer

Internet Explorer

MSN Explorer

AOL Explorer

AOL 8.0

AOL 9.0

CompuServe 2000

Aim

Netcaptor

Browse3d

Macromedia Dreamweaver

Macromedia contribute

Netscape 8 (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 flag to the dwflags parameter of the dochostuiinfo structure, as shown in the following example.

HRESULT GetHostInfo(DOCHOSTUIINFO *pInfo){...pInfo->cbSize = sizeof(DOCHOSTUIINFO);pInfo->dwFlags = { Other DOCHOSTUIFLAGs } |DOCHOSTUIFLAG_ENABLE_ACTIVEX_INACTIVATE_MODE;...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)SOFTWAREMicrosoft Internet ExplorerMainFeatureControlFEATURE_ENABLE_ACTIVEX_INACTIVATE_MODEprocess_name.exe=(DWORD) 0x00000001

Note:: Because you can modify the registry, the dochostuiinfo flag 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

2007 Microsoft Corporation is copyrighted. All rights reserved. Usage rules.

Back to Top

Reprinted description
Author: Microsoft msdn related articles
URL: This article reference from http://www.microsoft.com/china/MSDN/library/NetComm/activating_activex.mspx? MFR = true

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.