Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

MouseMove on webbrowser1

Posted on 2000-04-06
5
Medium Priority
?
392 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 400 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
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…
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…
Suggested Courses

963 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