Private Type RECT Left As Long Top As Long Right As Long Bottom As LongEnd TypePrivate Declare Function GetClientRect Lib "user32" (ByVal hWnd As Long, _ lpRect As RECT) As LongPrivate Declare Function ClientToScreen Lib "user32" (ByVal hWnd As Long, _ lpPoint As Any) As LongPrivate Declare Function ClipCursor Lib "user32" (lpRect As Any) As Long' confine (clip) the mouse's cursor to the client' area of a given window or control.' if the argument is omitted, any current clipping is canceledSub ClipMouseToWindow(Optional ByVal hWnd As Long) Dim rcTarg As RECT If hWnd Then ' clip the mouse to the specified window ' get the window's client area GetClientRect hWnd, rcTarg ' convert to screen coordinates. Two steps: ' first, the upper-left corner ClientToScreen hWnd, rcTarg ' next, the bottom-right corner ClientToScreen hWnd, rcTarg.Right ' finally, we can clip the cursor ClipCursor rcTarg Else ' unclip the mouse if no argument has been passed ClipCursor ByVal 0& End IfEnd Sub


The Best Mechanical Keyboards For Programmers: Where To Find Them
When it comes to programming, a good mechanical keyboard can make all the difference. Naturally, you would want one of the best mechanical keyboards for programmers. But with so many