|
-
Jul 23rd, 1999, 11:17 AM
#1
Thread Starter
New Member
is there a way to add a mouse up event or click event to the brwWebBrowser area. Note: the issue 'im having is that i can't send text from a browser window with "FRAMES"
example: If the one of the frame names is "home" then brwWebBrowser.Document.frames.home.focus ' will go to the frame.... but what if you don't know the frame name. How do you find the name of the frame...
Sounds like fun A=-)
-
Jul 24th, 1999, 11:07 AM
#2
Addicted Member
OK. You can provide a mouseup event for the webbrowser control by setting up a subclassing hook and detecting the mouseup message (I can't remember the constant for it).
To get the frame names you will need to parse out the main page for the names of the frames. E.g.
lngFrameStart=Instr(strDocument, "<frame name=")
lngFrameEnd=Instr(lngFrameStart, strDocument, ">")
strFrameName=Mid(strDocument, lngFrameStart +1, (lngFrameEnd - lngFrameStart)-1)
Then to find the second frame name just use:
lngFrameStart=Instr(lngFrameEnd,strDocument,"<frame name=")
lngFrameEnd=Instr(lngFrameStart,strDocument, ">")
strFrameName=Mid(strDocument, lngFrameStart+1, (lngFrameEnd-lngFrameStart)-1)
Hope that helps.
[This message has been edited by vbsquare (edited 07-24-1999).]
-
Jul 25th, 1999, 06:22 PM
#3
Thread Starter
New Member
THANK YOU FOR YOUR INPUT,
At MS Developpers i found all the mouse APIs listed http://msdn.microsoft.com/library/sd...sinpt_5gs3.htm
THE WM_NCLBUTTONUP subclass is what i'm looking for, Unfortunatly it's not showing me how to use it. If any one has any examples using this as a "subclass hook" please give feed back. The subclass should detect when the left mouse button is released while in a BrowserForm field...
-
Jul 26th, 1999, 01:35 AM
#4
Addicted Member
Sure. You will need to add a module (because subclassing can only be done in a standard module) and add this code:
Private Const (Add the mouseup constant here)
Private OldProc As Long
Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" _
(ByVal hWnd As Long, ByVal nIndex As Long, _
ByVal dwNewLong As Long) As Long
Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" _
(ByVal hWnd As Long, ByVal nIndex As Long) As Long
Public Const GWL_WNDPROC = (-4)
Declare Function CallWindowProc Lib "user32" Alias "CallWindowProcA" _
(ByVal lpPrevWndFunc As Long, ByVal hWnd As Long, _
ByVal Msg As Long, _
ByVal wParam As Long, ByVal lParam As Long) As Long
Public Function WndProc(ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
Select Case wMsg
Case (Constant Name Here)
'Do your popup code here
WndProc=0
Exit Function
Case Else
'Pass on messages
WndProc = CallWindowProc(OldProc, wMsg, wParam, lParam)
End Function
Now in a form add:
Private Sub Form_Load()
OldProc=GetWindowLong(Webbrowser1.hWnd, GWL_WNDPROC)
SetWindowLong Webbrowser1.hWnd, GWL_WNDPROC, AddressOf WndProc)
End Sub
Private Sub Form_Unload()
'Important!
SetWindowLong Webbrowser1.hWnd, GWL_WNDPROC, OldProc
End Sub
For a better explanation, view my article at http://www.programmerz.com/vb/subcls/
Please could you send me that constant. Thanks.
[This message has been edited by vbsquare (edited 07-26-1999).]
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
|