add a reference to %systemroot%\mshtml.dll and try something like (did not test, so there might be errors):Dim WithEvents HTMLdoc As HTMLDocumentPrivate Sub Form_Load()
   WebBrowser1.Navigate "about:blank"
End SubPrivate Sub Command1_Click()
   WebBrowser1.Navigate "http://www.csdn.net"
End SubPrivate Sub WebBrowser1_DocumentComplete(ByVal pDisp As Object, URL As Variant)
  Set HTMLdoc = WebBrowser1.Document
End SubFunction HTMLdoc_onContextMenu() as Boolean
    HTMLdoc_onContextMenu = False
End Function
Private Sub HTMLdoc_onKeyDown()
  Dim eventObj As IHTMLEventObj
  Set eventObj = HTMLdoc.parentWindow.event
  If eventObj.keyCode = 27 Then
     MsgBox ("!!!!!!!!!!!!")
     Unload Me
  End If
End Sub