Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Mouse *NOT* over detection

Status
Not open for further replies.

Retsacnal

Programmer
Jan 24, 2002
5
0
0
AU
Hi,

Is there an easy way to detect when the mouse is not over a window. I what a "mouse over" type behaviour for my window, but I need to know when to "turn off" the mouse over effects when the mouse leaves my window.

Thanks,

Ryan.
 
This should do it....

---------------------------------------------------------
Option Explicit
Private Type POINTAPI
x As Long
y As Long
End Type
Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long

Private Sub Timer1_Timer()
Dim z As POINTAPI
GetCursorPos z 'Get Co-ordinets
If z.x < Left / Screen.TwipsPerPixelX Or z.x > (Left + Width) / Screen.TwipsPerPixelX Or _
z.y < Top / Screen.TwipsPerPixelY Or z.y > (Top + Height) / Screen.TwipsPerPixelY Then MsgBox &quot;out&quot;
End Sub
----------------------------------------------------------
Sunaj
'The gap between theory and practice is not as wide in theory as it is in practice'
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top