Results 1 to 3 of 3

Thread: Webbrowser Control - Preventing use of Alt-Left Arrow Key or Right mouse click

  1. #1

    Thread Starter
    Member
    Join Date
    Jun 2001
    Location
    Toronto, Ontario, Canada
    Posts
    56

    Webbrowser Control - Preventing use of Alt-Left Arrow Key or Right mouse click

    How would one use the webbrowser Control but capture the user right mouse click or alt-left arrow (hot key to go back to previous webpage) before the Control recieves it?

    I've tried capturing the keystrokes at Form level:

    Code:
    Private Form_KeyDown(KeyCode As Integer, Shift As Integer)
        If (KeyCode = 37) And (Shift = 4) Then
            Label1.Caption = "message caught"
        End If
    End Sub
    ... but that doesn't work.

    I've tried making a new usercontrol with the webbrowser embedded into it with the code above implemented at UserControl level.. no luck again...

    Any suggestions/solutions?

  2. #2
    Hyperactive Member
    Join Date
    Apr 2001
    Posts
    315
    For ALt+Left, try Before_Navigate2 event which has a Cancel capability. I have not tried it. I'm tired. If your users do not need to be able to highlight and copy then you might try setting .Visible = false in GotFocus and .Vsible = true in LostFocus. Dumb, but still food for thought.

  3. #3

    Thread Starter
    Member
    Join Date
    Jun 2001
    Location
    Toronto, Ontario, Canada
    Posts
    56
    Thanks for the reply. Actually, I think the problem maybe even more general than what I specified...

    I now need to prevent certain keystrokes all together from reaching the webbrowser control... (ALT-Left, Ctrl-N (new window), CTRL+A (select All), F5 (refresh)).

    Is there a way to trap the keystrokes instead?

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