How to dedect if mouse or key is pressed on Webbrowser?
There's no such thing like Webbrowser1_Click or Webbrowser1_MouseDown
I need to start a countdown timer every time user clicks on the webbrowser
So it'd show idle time or something
Printable View
How to dedect if mouse or key is pressed on Webbrowser?
There's no such thing like Webbrowser1_Click or Webbrowser1_MouseDown
I need to start a countdown timer every time user clicks on the webbrowser
So it'd show idle time or something
add a reference to the HTML Object library
VB Code:
Dim WithEvents HTMLDOC As HTMLDocument Private Sub Form_Load() WebBrowser1.Navigate "www.vbforums.com" End Sub Private Function HTMLDOC_onclick() As Boolean Debug.Print "CLICK!" End Function Private Sub HTMLDOC_onmousedown() Debug.Print "MOUSEDOWN!" End Sub Private Sub HTMLDOC_onmouseup() Debug.Print "MOUSEUP!" End Sub Private Function HTMLDOC_onmousewheel() As Boolean Debug.Print "MOUSEWHEEL!" End Function Private Sub WebBrowser1_DocumentComplete(ByVal pDisp As Object, URL As Variant) If Not WebBrowser1.Document Is Nothing Then Set HTMLDOC = WebBrowser1.Document End If End Sub
It detects it when I create new project and test the code on it.
But if I try the code on my existing project, it won't work.
What could block/interrupt this code?
actually not sure what would stop it from working?!??
But is it possible, to create some area with API or something, and detect, if mouse is clicked there?
All controls have both a mouse down and click event if that is what you mean.Quote:
Originally Posted by Sannu
actually Hack, the webbrowser control doesnt...
Yes, that's what i mean..
Bump
Well If you want to get all the clicks of all the webbrowser then you have to do like a download software "Reget Delux" does, it installs a .dll as we installs Flash Plugin.
So you have to develop such plugin so you can get what ever happneing at WebBrowser even at iexplore.exe
no you can't just understand
I have a form
I have a wb on it
I want to capture all clicks on webbrowser
As i told you to do so, you have to make a IE plugin that will capture all clicks and the appropriate function (defined by you) will be called
other Relatively Easy way to accomplish goal is
When ever the page is loded then add some JavaScript Using InnerHTML property than would be like OnClick="Javascript:document.location(sannu://click)
and capture it at navigate event
the code I posted should work.. if it worked in its own project.. then something u have going on is stopping it. keep playing.
Ya it is working perfectly...Quote:
Originally Posted by Static
But if he Wants to do by api he might be asking for Hooking
API is not always the best way ;)Quote:
Originally Posted by Vishalgiri