Results 1 to 4 of 4

Thread: Disable webBrowser1 right-click.

Hybrid View

  1. #1

    Thread Starter
    Fanatic Member tim_l_012's Avatar
    Join Date
    Mar 2001
    Location
    Next to a Coffee Cup.
    Posts
    641

    Question Disable webBrowser1 right-click.

    How can I disable the right-click of a webbrowser control?
    /: Tim :\____________________
    \: VB, HTML, ASP, VBScript, QBASIC, JavaScript :/

  2. #2

    Thread Starter
    Fanatic Member tim_l_012's Avatar
    Join Date
    Mar 2001
    Location
    Next to a Coffee Cup.
    Posts
    641
    come on, there must be someway, vb can do everything, can't it?
    /: Tim :\____________________
    \: VB, HTML, ASP, VBScript, QBASIC, JavaScript :/

  3. #3
    Frenzied Member
    Join Date
    Mar 2001
    Location
    You are HERE •™
    Posts
    1,300
    This is probably the easiest way to do it.
    Be sure to make a reference to the MSHTML.lib (Microsoft HTML Object Library).


    VB Code:
    1. Option Explicit
    2. Dim WithEvents hDoc As HTMLDocument
    3.  
    4.  
    5. Private Sub Form_Load()
    6.     WebBrowser1.Navigate "'http://www.yahoo.com"
    7. End Sub
    8.  
    9. Private Function hDoc_oncontextmenu() As Boolean
    10.     hDoc_oncontextmenu = False
    11. End Function
    12.  
    13. Private Sub WebBrowser1_BeforeNavigate2(ByVal pDisp As Object, URL As Variant, Flags As Variant, TargetFrameName As Variant, PostData As Variant, Headers As Variant, Cancel As Boolean)
    14.     Set hDoc = Nothing
    15. End Sub
    16.  
    17. Private Sub WebBrowser1_DocumentComplete(ByVal pDisp As Object, URL As Variant)
    18.     Set hDoc = WebBrowser1.Document
    19. End Sub

  4. #4
    Junior Member
    Join Date
    Aug 2015
    Posts
    27

    Thumbs up Re: Disable webBrowser1 right-click.

    Very useful one thank you ^_^

    Quote Originally Posted by Bloodeye View Post
    This is probably the easiest way to do it.
    Be sure to make a reference to the MSHTML.lib (Microsoft HTML Object Library).

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width