Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.

Automatic ActiveX Activation in Visual Studio 2003 and 2005


Author: Alvin Bruney MVP

View products that this article applies to.

Summary

This article describes the workaround to activating ActiveX controls in Internet Explorer.

↑ Back to the top


Abstract

ActiveX objects rendered using the <object>, <applet> or <embed> tag in Internet Explorer need to be explicitly enabled before they will run. The explicit step usually requires an extra mouse click or�space bar�and enter key press. The activation restriction was implemented by Microsoft as a remedy to the Eolas Technologies Inc. patent infringement lawsuit.

Microsoft has adjusted the way in which browser activation occurs by releasing a software patch to Internet Explorer 912945 to cause the browser to load the ActiveX control in an inactive state by default meaning that the control will respond to programmatic instructions but not to user events.

The workaround suggested by Microsoft is to load the ActiveX control from an external script file. Controls loaded in this way are immediately active and do not require any user click. Follow the code below to implement the workaround.

  1. Add�a link to an external file with the "src" attribute in your client page.
<scriptlanguage="javascript"src="mysamplefile.js">

  1. Add an external file to your web project called mysamplefile.js
  2. In that file, write out the object.
  3. document.write('<OBJECT id="myControl1" name="myControl1" classid="WindowsActiveX.dll#WindowsActiveX.WindowsUserControl" width=600 height=272 > </OBJECT>');

Note: The example illustrates a managed ActiveX control. Unmanaged ActiveX controls would simply need to change the classid.

One other workaround is to uninstall the Internet Explorer 912945 patch from Control Panel. However, Microsoft may possibly add the software patch as a cumulative security patch to Windows update automatically. Therefore, this approach is recommended.

The details of the Internet Explorer patch may be found here http://www.microsoft.com/technet/security/advisory/912945.mspx


↑ Back to the top


Community solutions content disclaimer

Microsoft corporation and/or its respective suppliers make no representations about the suitability, reliability, or accuracy of the information and related graphics contained herein. All such information and related graphics are provided "as is" without warranty of any kind. Microsoft and/or its respective suppliers hereby disclaim all warranties and conditions with regard to this information and related graphics, including all implied warranties and conditions of merchantability, fitness for a particular purpose, workmanlike effort, title and non-infringement. You specifically agree that in no event shall Microsoft and/or its suppliers be liable for any direct, indirect, punitive, incidental, special, consequential damages or any damages whatsoever including, without limitation, damages for loss of use, data or profits, arising out of or in any way connected with the use of or inability to use the information and related graphics contained herein, whether based on contract, tort, negligence, strict liability or otherwise, even if Microsoft or any of its suppliers has been advised of the possibility of damages.

↑ Back to the top


Keywords: KB555662, kbhowto, kbpubtypewp, kbpubtypecca, kbpubmvp

↑ Back to the top

Article Info
Article ID : 555662
Revision : 1
Created on : 7/13/2006
Published on : 7/13/2006
Exists online : False
Views : 373