[RESOLVED] If mouse is outside a label Then...
As the title says, is it possible to excecute a line of code when your mouse is over a label, then when it's moved outside the label? I succeded to run a line of code by having your mouse over the label.
Code:
Private Sub Label6_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Label6.Caption = "-Exit-" 'the label was first "Exit". It's like making a label to a button.
End Sub
If you know how to run a code when the mouse is outside the label, please reply back. Thanks!
Re: If mouse is outside a label Then...
Because Label's do not have an .hWnd property, doing what you ask is a bit hit or miss.
Try using the Form_Move event.
Re: If mouse is outside a label Then...
I would try to identify the boundaries of the label, then use something like this to figure out where the cursor is:
Code:
Dim cur_point As POINTAPI
Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
Private Type POINTAPI
X As Long
Y As Long
End Type
Put the above code in your General Declarations.
Code:
GetCursorPos cur_point
Put the above in a timer event and check the current coordinates against the boundaries of the label.
Let me know if that makes sense!