Microsoft KB Archive/183235

= WBCustomizer.dll Implements IDocHostUIHandler for VB =

Article ID: 183235

Article Last Modified on 4/21/2006

-

APPLIES TO


 * Microsoft Internet Explorer 4.0 128-Bit Edition
 * Microsoft Internet Explorer 4.01 Service Pack 2
 * Microsoft Internet Explorer 5.0
 * Microsoft Internet Explorer 5.5
 * Microsoft Visual Basic 5.0 Professional Edition
 * Microsoft Visual Basic 5.0 Enterprise Edition

-



This article was previously published under Q183235



SUMMARY
WBCustom.exe contains the WBCustomizer.dll, a sample COM object that demonstrates how to implement the IDocHostUIHandler interface for use in Visual Basic (VB) applications. If you are developing applications using the Internet Explorer 4.0x (IE4) WebBrowser control, the IDocHostUIHandler interface allows you to perform certain user interface functions, such as turning off context menus and accelerator keys.

If you are a Visual Basic developer and you are using the Internet Explorer 4.0 WebBrowser control, WBCustomizer allows you to perform the following:
 * Turn context menus on or off.
 * Turn all accelerator keys on or off.
 * Turn specific accelerator keys on or off.

The WBCustom.exe file includes the compiled WBCustomizer ATL object, as well as the ATL source code, so that you can customize this control to fit your own needs. WBCustom.exe also includes a sample Visual Basic application that demonstrates how to use the WBCustomizer control.

Please read the MORE INFORMATION section for instructions on how to use WBCustomizer in your Visual Basic application.

NOTE: This sample is not supported by Microsoft. If you require additional functionality, you can change the source code.



MORE INFORMATION
The following file is available for download from the Microsoft Download Center:

WBCustom.exe

For additional information about how to download Microsoft Support files, click the following article number to view the article in the Microsoft Knowledge Base:

119591 How to Obtain Microsoft Support Files from Online Services

Microsoft scanned this file for viruses. Microsoft used the most current virus-detection software that was available on the date that the file was posted. The file is stored on security-enhanced servers that help to prevent any unauthorized changes to the file.

Using the WBCustomizer Control
 Register WBCustomizer.dll on your system by using regsvr32 as follows:

regsvr32 WBCustomizer.dll

 Create a new Visual Basic application. (You can use a pre-existing Visual Basic application that is hosting the WebBrowser control.) Include the component "Microsoft Internet Controls" in your application. Draw the WebBrowser control on your form. Set a reference to "Microsoft WebBrowser Customizer Sample Object." Dim a variable of type WBCustomizer as follows:

Dim CustomWB As WBCustomizer

 In your Form_Load event, create a new instance of the WBCustomizer object as follows:

Set CustomWB = New WBCustomizer

</li> WBCustomizer needs a reference to the WebBrowser control that is on your form so that WBCustomizer can perform user interface functions for the WebBrowser control. Set this reference using the WBCustomizer.WebBrowser property as follows:

Set CustomWB.WebBrowser = WebBrowser1

Please note that WBCustomizer includes get and put functions for the WebBrowser method. However, the get function is not currently implemented. You may implement this yourself if you need this functionality.</li> Turn on/off context menus by setting the EnableContextMenus property. A value of True turns context menus on. False turns them off.</li> Turn on/off all shortcut keys by setting the EnableAllAccelerators property. A value of True turns context menus are on. False turns them off. Only those accelerators that require CTRL, SHIFT, or ALT key combinations will be turned off. Those that do not require one of these keys, such as TAB, F1, and so forth, can be turned off directly as described in step 11.

Note that the Ctrl+O accelerator that worked in Internet Explorer 4 is no longer available in version 5 within the WebBrowser control.</li> Turn on/off specific accelerator keys by using the EnableAccelerator method. The following parameters apply to this method: <ul> nKeyCode - The key code constant that specifies an accelerator key (vbKeyTab, vbKeyN, vbKeyO, and so on).</li> nVirtExtKey - The virtual key code of an extended key, such as vbKeyControl, vbKeyAlt, or vbKeyShift. This parameter is optional and has a default value of 0.</li> bState - The state of the accelerator key. True turns on the accelerator key and False turns it off.</li></ul> </li></ol>

<div class="references_section">