Solved

MouseMove on webbrowser1

Posted on 2000-04-06
5
381 Views
Last Modified: 2006-11-17
How can I find out if the mouse is on webbrowser1?
0
Comment
Question by:derekcmartin
  • 3
  • 2
5 Comments
 
LVL 6

Accepted Solution

by:
VBGuru earned 100 total points
ID: 2689733
Have timer control and a webbrowser control, copy and paste the following piece of code.

Private Type POINTAPI
    x As Long
    y As Long
End Type
Dim P As POINTAPI
Private Declare Function ScreenToClient Lib "user32" (ByVal hwnd As Long, lpPoint As POINTAPI) As Long
Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long

Private Sub Form_Load()
Timer1.Interval = 200
End Sub

Private Sub Timer1_Timer()
    P.x = 0
    P.y = 0
    GetCursorPos P
    'Get information about the form's left and top
    ScreenToClient hwnd, P
    If P.x >= WebBrowser1.Left And P.x <= WebBrowser1.Left + WebBrowser1.Width And P.y >= WebBrowser1.Top And P.y <= WebBrowser1.Top + WebBrowser1.Height Then
        msgbox "Cursor on the webbrowser control"
    End If
End Sub
0
 
LVL 1

Author Comment

by:derekcmartin
ID: 2689816
Adjusted points from 70 to 100
0
 
LVL 1

Author Comment

by:derekcmartin
ID: 2689817
Thanks a lot, it works great!
0
 
LVL 1

Author Comment

by:derekcmartin
ID: 2689824
I increased the points because you were so quick to respond, and it works excellent!
0
 
LVL 6

Expert Comment

by:VBGuru
ID: 2689918
thank you for the points
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

860 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question