PDA

Click to See Complete Forum and Search --> : Right Click on WebBrowser


JFryes
Feb 1st, 2001, 06:28 PM
I have found many snippets of code explaining how to change the right click menus of forms, textboxes, etc, but I can't for the life of me find a way to get a WebBrowser right click menu to change. This is due to the lack of a WebBrowser_Mousedown() subfunction. Does anyone have any ideas on how to modify a WebBrowser's Right Click menu?

Feb 1st, 2001, 07:13 PM
To remove Right Click menu from WebBrowser Control:

http://support.microsoft.com/suppor...s/Q183/2/35.ASP
http://msdn.microsoft.com/downloads...izer/sample.asp


And use the GetCursorPos API function to get where the cursor is which will be needed for when you use the GetAsyncKeyState API function to tell whether the mouse button has been right clicked on the WebBrowser Control.


Private Type POINTAPI
X As Long
Y As Long
End Type

Private Declare Function GetCursorPos _
Lib "user32" (lpPoint As POINTAPI) As Long


Usage


Private Sub Command1_Click()

Dim PT As POINTAPI
GetCursorPos PT
MsgBox "(" & PT.x & "," & PT.y & ")"

End Sub





Private Declare Function GetAsyncKeyState Lib "user32" _
(ByVal vKey As Long) As Integer


Usage


Private Sub Command1_Click()

If GetAsyncKeyState(vbRightButton) Then _
Msgbox "Right mouse button clicked"

End Sub