Solved

MouseMove on webbrowser1

Posted on 2000-04-06
5
358 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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

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…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

707 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now