-
August 29th, 1999, 02:59 PM
#1
Using webbrowser control
I am using webbrowser control in CBT application created using VB.
I am displaying texts and pictures in the webbrowser control .When i
right click on the webbrowser control a pop menu appears.I don't want
this to happen.Is there any way of supressing the pop menu from appearing
when i right click the menu.Please provide me with a solution
thank you
thamizhan
Email:marathamizhan@yahoo.com
-
January 4th, 2000, 05:48 AM
#2
Re: Using webbrowser control
Yes, by implementing IDocHostUIHandler Interface.
Here's some code:
Option Explicit
Implements IDocHostUIHandler
Private Const CONTEXT_MENU_CONTROL = 2&
Private Const E_NOTIMPL = &H80004001
Private Sub Form_Load()
'This form has a WebBrowser control
End Sub
Private Sub IDocHostUIHandler_EnableModeless(ByVal fEnable As Long)
Err.Raise E_NOTIMPL
End Sub
Private Sub IDocHostUIHandler_FilterDataObject(ByVal pDO As WebBrowserInterfaces.IDataObject, ppDORet As WebBrowserInterfaces.IDataObject)
Err.Raise E_NOTIMPL
End Sub
Private Sub IDocHostUIHandler_GetDropTarget(ByVal pDropTarget As WebBrowserInterfaces.IDropTarget, ppDropTarget As WebBrowserInterfaces.IDropTarget)
Err.Raise E_NOTIMPL
End Sub
Private Sub IDocHostUIHandler_GetExternal(ppDispatch As Object)
Err.Raise E_NOTIMPL
End Sub
Private Sub IDocHostUIHandler_GetHostInfo(pInfo As WebBrowserInterfaces.DOCHOSTUIINFO)
Err.Raise E_NOTIMPL
End Sub
Private Sub IDocHostUIHandler_GetOptionKeyPath(pchKey As String, ByVal dw As Long)
Err.Raise E_NOTIMPL
End Sub
Private Sub IDocHostUIHandler_HideUI()
Err.Raise E_NOTIMPL
End Sub
Private Sub IDocHostUIHandler_OnDocWindowActivate(ByVal fActivate As Long)
Err.Raise E_NOTIMPL
End Sub
Private Sub IDocHostUIHandler_OnFrameWindowActivate(ByVal fActivate As Long)
Err.Raise E_NOTIMPL
End Sub
Private Sub IDocHostUIHandler_ResizeBorder(prcBorder As WebBrowserInterfaces.tagRECT, ByVal pUIWindow As WebBrowserInterfaces.IOleInPlaceUIWindow, ByVal fRameWindow As Long)
Err.Raise E_NOTIMPL
End Sub
Private Sub IDocHostUIHandler_ShowContextMenu(ByVal dwID As Long, ppt As WebBrowserInterfaces.tagPOINT, ByVal pcmdtReserved As Long, ByVal pdispReserved As Object)
If dwID = CONTEXT_MENU_CONTROL Then _
Err.Raise E_NOTIMPL
End Sub
Private Sub IDocHostUIHandler_ShowUI(ByVal dwID As Long, ByVal pActiveObject As WebBrowserInterfaces.IOleInPlaceActiveObject, ByVal pCommandTarget As WebBrowserInterfaces.IOleCommandTarget, ByVal pFrame As WebBrowserInterfaces.IOleInPlaceFrame, ByVal pDoc As WebBrowserInterfaces.IOleInPlaceUIWindow)
Err.Raise E_NOTIMPL
End Sub
Private Sub IDocHostUIHandler_TranslateAccelerator(lpmsg As WebBrowserInterfaces.tagMSG, pguidCmdGroup As WebBrowserInterfaces.Guid, ByVal nCmdID As Long)
Err.Raise E_NOTIMPL
End Sub
Private Sub IDocHostUIHandler_TranslateUrl(ByVal dwTranslate As Long, ByVal pchURLIn As String, ppchURLOut As String)
Err.Raise E_NOTIMPL
End Sub
Private Sub IDocHostUIHandler_UpdateUI()
Err.Raise E_NOTIMPL
End Sub
Private Sub WebBrowser1_DocumentComplete(ByVal pDisp As Object, URL As Variant)
Dim custDoc As ICustomDoc
' Setting UIHandler
Set custDoc = WebBrowser1.Document
custDoc.SetUIHandler Me
End Sub
-
January 4th, 2000, 05:41 PM
#3
Re: Using webbrowser control
I had the same problem the knowledge base article attached will help.
Richard
Q183235 SAMPLE: WBCustomizer.dll Implements IDocHostUIHandler for VB
WBCustomizer.dll Implements IDocHostUIHandler for VB
--------------------------------------------------------------------------------
The information in this article applies to:
Microsoft Internet Explorer (Programming) versions 4.0, 4.01, 5
Microsoft Visual Basic Professional and Enterprise Editions for Windows, version 5.0
--------------------------------------------------------------------------------
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. Click the file name below to download the file:
WBCustom.exe
For more information about how to download files from the Microsoft Download Center, please visit the Download Center at the following Web address
http://www.microsoft.com/downloads/search.asp
and then click How to use the Microsoft Download Center.
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
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.
Turn on/off context menus by setting the EnableContextMenus property. A value of True turns context menus on. False turns them off.
Turn on/off all accelerator 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.
Turn on/off specific accelerator keys by using the EnableAccelerator method. The following parameters apply to this method:
nKeyCode - The key code constant that specifies an accelerator key (vbKeyTab, vbKeyN, vbKeyO, and so on).
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.
bState - The state of the accelerator key. True turns on the accelerator key and False turns it off.
REFERENCES
Please refer to "Advanced Hosting Interfaces" in the Internet Client SDK Help for more information regarding IDocHostUIHandler:
http://www.microsoft.com/msdn/sdk/in...rog/IEProg.htm
(c) Microsoft Corporation 1998, All Rights Reserved. Contributions by Scott Roberts, Microsoft Corporation
Additional query words:
Keywords : kbfile kbsample kbIE400 kbIE401 kbVBp500 kbIE500 AXSDKWebBrowser
Version : WINDOWS:4.0,4.01,5,5.0
Platform : WINDOWS
Issue type : kbinfo
Richard Barnes
Lead Design Scientist
Coynet International/Public Access Technologies
-
January 4th, 2000, 05:45 PM
#4
Re: Using webbrowser control
Sorry Like an idot I forgot to include the URL to download the example here it is.
http://download.microsoft.com/downlo...S/WBCustom.exe
Richard Barnes
Lead Design Scientist
Coynet International/Public Access Technologies
-
January 13th, 2000, 06:34 AM
#5
Re: Using webbrowser control
Can I use my own pop-up menu?
-
January 13th, 2000, 09:48 AM
#6
Re: Using webbrowser control
looks great. what Reference do have to add to the project to get access to that Interface (IDocHostUIHandler)?
-
January 17th, 2000, 07:54 AM
#7
Re: Using webbrowser control
References: WebBrowser control host interfaces (wbctrl.tlb)
-
January 18th, 2000, 02:52 AM
#8
Re: Using webbrowser control
Thanks for answering.
Still, I can't find that type lib on my machine (NT 4, IE 5, VB 6). Can you give me a source from where to get that typelib?
-
January 18th, 2000, 06:24 AM
#9
Re: Using webbrowser control
I eventually found it buried deep within the MSDN (both CD and Internet) - do a search on the interface name and 'vb' and you should find the KB article. It comes with a program (wbbrowser? - can't remember) and BTW, the program is 'unsupported' so don't rely on it too much.
Chris Eastwood
CodeGuru - the website for developers
http://codeguru.developer.com/vb
-
January 18th, 2000, 07:15 AM
#10
Re: Using webbrowser control
Thanx alot.
It's amazing, I haven't used my primary source of information :-)
Well, I am not afraid of "unsupported" MS tools. What is REALLY supported?
BTW, if you search for "WBCustomizer" on MSDN you'll find it more quickly.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|