Click to See Complete Forum and Search --> : Webbrowser Mouse Event
NiteStone
January 31st, 2000, 12:54 AM
Hi all,
Do You know how to detect mouse click or not on webbrowser control? Or how to simulate mouse click? Any idea is appreciated. Thanks.
NiteStone
Lothar Haensler
January 31st, 2000, 02:22 AM
to trap the click event on an HTML document that resides in a Web browser control, try this
option Explicit
private withevents d as HTMLDocument
private Sub Command1_Click()
w.Navigate "http://yourURLgoeshere"
End Sub
private Function d_onclick() as Boolean
MsgBox "clicked"
End Function
private Sub w_NavigateComplete2(byval pDisp as _
Object, URL as Variant)
set d = w.Document
End Sub
This might break in many cases, e.g. framesets.
to simulate a mouseclick, try the mouse_event API or SendInput.
NiteStone
January 31st, 2000, 04:15 AM
Thanks for the reply. I have tried it and got an error: user-defined type not defined" on HTMLDocument. I am using VB5. Is HTMLDocument only available in VB6?
NiteStone
Lothar Haensler
January 31st, 2000, 04:43 AM
no, it's not.
You need to add a reference to your vb project "Microsoft HTML Object Library"
NiteStone
January 31st, 2000, 05:28 AM
Thanks again for the reply. Truelly appreciate this. :)
I have looked "reference" under project manu yet unable to find "Microsoft HTML object library". Please tell me where to find it?
NiteStone
Lothar Haensler
January 31st, 2000, 06:01 AM
see if you can find an MSHTML.TLB in your system32 directory. Add that to the references.
Do you have access to IE 4 or 5? AFAIK that Typelib comes with IE.
NiteStone
January 31st, 2000, 07:03 AM
Yeah, I have found the library file and added to the project. The codes works great. Thanks million times!! :)
NiteStone
I used IE4. Not update to IE5 yet.
February 17th, 2000, 02:39 AM
What is W
Is it a HTMLwindow?
Lothar Haensler
February 17th, 2000, 02:59 AM
No, "w" is the name of the WebBrowser Control that I placed on the form.
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.