Solved

MouseMove on webbrowser1

Posted on 2000-04-06
5
383 Views
Last Modified: 2006-11-17
How can I find out if the mouse is on webbrowser1?
0
Comment
Question by:derekcmartin
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
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…

751 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