How can you capture the mouse to enter and leave the form?
Here you need to use two APIs, ie setcapture and releasecapture.
Create a new project and place the following code into the code area. Press F5 to run.
Option expedition
Private Declare Function SetCapture LIB "User32" (BYVAL HWND As Long) As longprivate declare function release recrivate lib "user32" () AS Long
Private Sub Form_MouseMove (Button As Integer, Shift As Integer, x as single, y as single) with form1 if not ((x <0) or (x> .width) or (y> .height) "Then releaseCapture if .caption <>" came in "Then .caption =" came in "end if setcapture .hwnd else .caption =" End if End welhend Sub
Now move your mouse to the form.
--- Procedure: Tang Yan Kong