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
Printable View
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
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.
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
no, it's not.
You need to add a reference to your vb project "Microsoft HTML Object Library"
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
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.
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.
What is W
Is it a HTMLwindow?
No, "w" is the name of the WebBrowser Control that I placed on the form.