Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Trap Function Keys at Form Level

Status
Not open for further replies.

ajmcqueen

Technical User
Mar 20, 2002
3
GB
Hi

This may have been asked before but what I want to do is intercept Function Keys such as F8 at the form level and prevent them reaching an embedded Web Browser component. VB6 by the way.

Thanks

Andy
 
Set the form's .KeyPreview property to true
Then, put code in the KeyUp (or KeyDown) event.

Start a new VB project with a single form.
Put in this code.

Code:
Option Explicit

Private Sub Form_KeyUp(KeyCode As Integer, Shift As Integer)
    
    Call MsgBox("KeyCode: " & CStr(KeyCode) & vbCrLf & "Shift: " & CStr(Shift))
    
End Sub

Private Sub Form_Load()
    
    Me.KeyPreview = True

End Sub

-George

Strong and bitter words indicate a weak cause. - Fortune cookie wisdom
 
George

It works fine until I load a pdf document into the Web Browser. Then it doesn't fire and the PDF ActiveX PlugIn gets the F8 function key, which shows or hides it's menu bar.it is this behaviour that I want to stop.

Regards

Andy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top