VB Code:
Private Declare Function SetCapture Lib "user32" (ByVal hwnd As Long) As Long Private Declare Function ReleaseCapture Lib "user32" () As Long Private Declare Function GetCapture Lib "user32" () As Long Private Sub Command1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) Select Case True Case X < 0, Y < 0, X > Command1.Width, Y > Command1.Height ' Leaving ReleaseCapture ' Do Stuff Debug.Print "Leaving" Case Not GetCapture() = Command1.hwnd ' Entering SetCapture Command1.hwnd ' Do Stuff Debug.Print "Entering" End Select End Sub




Reply With Quote