'add a picturebox, a timer and a label
Private Declare Function WindowFromPoint Lib "user32" (ByVal xPoint As Long, ByVal yPoint As Long) As Long
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 hCursorWnd As Long, point As POINTAPI
GetCursorPos point
hCursorWnd = WindowFromPoint(point.x, point.y)
If Picture1.hWnd <> hCursorWnd Then
Label1.Caption = "out of picturebox"
Else
Label1.Caption = "in picturebox"
End If