|
-
Apr 28th, 2003, 05:18 PM
#1
Thread Starter
Frenzied Member
webbrowser control keypress of Ctrl + N
OK: i have found this code in a post, whilst trying to find right click....
now im guessin i need reference to the MS HTML Object etc...
but it still errors.. what else do i need to add to the code? is the code complete or?
VB Code:
Private Sub webPage_DocumentComplete(ByVal pDisp As Object, URL As Variant)
Set doc = webPage.Document
End Sub
Private Sub doc_onmousedown()
Dim eventObj As IHTMLEventObj
Set eventObj = doc.parentWindow.event
If eventObj.Button = rightButton Then
If doc.selection.Type = "Text" Then
End If
PopupMenu mnuPage
End If
End Sub
i also found mension in another post about doc_onkeypress
but they didnt know the sections the functions had,
now, these posts are like ages old. so, can any of you guys help me with either of these please....
thanks
Last edited by wpearsall; Apr 29th, 2003 at 05:48 PM.
Wayne
-
Apr 29th, 2003, 05:39 PM
#2
Thread Starter
Frenzied Member
OK: i found this post in [this thread]
Originally posted by PunkRockNeil
With javascript you can determine the keypressed with the "keyCode" property of the event object...For example:
Code:
// if the user presses enter call the chkForm function
if (event.keyCode == 13){
chkForm();
}
now, i know i can call javascript functions from within vb, using the .Document property, but i dont know how i can implement this, into CANCELING the keypress in the browser,
but load a new form of my own program to handle the new windows..
can ne one help me with this please?
Thanks 
Wayne
-
Apr 29th, 2003, 05:56 PM
#3
Thread Starter
Frenzied Member
ok then,
this is what i have:
VB Code:
Option Explicit
Dim WithEvents Doc As HTMLDocument
Private Sub Doc_onmousedown()
Dim eventObj As IHTMLEventObj
Set eventObj = Doc.parentWindow.event
If eventObj.Button = vbRightButton Then
PopupMenu frmMain.mnuTools
End If
End Sub
Private Function Doc_onkeypress() As Boolean
Dim eventObj As IHTMLEventObj
Set eventObj = Doc.parentWindow.event
If eventObj.keycode = 14 Then
Doc_onkeypress = False
call frmMain.LoadNewDoc ()
Else
Doc_onkeypress = True
End If
End Function
Private Sub brwWebBrowser_BeforeNavigate2(ByVal pDisp As Object, URL As Variant, Flags As Variant, TargetFrameName As Variant, PostData As Variant, Headers As Variant, cancel As Boolean)
Set Doc = Nothing
End Sub
Private Sub brwWebBrowser_DocumentComplete(ByVal pDisp As Object, URL As Variant)
On Error Resume Next
Set Doc = brwWebBrowser.Document
End Sub
The right click works FINE!
keypress doesn't.
i can cancel presses like a-z 0-9, but i cant cancel control & N
it wont work like this for some reason?
can anyone help me with this please?
i am guessing this is the fact that ctrl & n is a shortcut, therefore the onkeypress dont control it?
but i cant think of anything else to try as of yet... anyone want to help wid dis plz
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|