如果不把代码timer中举罩做的话,按下徽标正衡键加D的话可以简单地取消区域限制。Option ExplicitPrivate Declare Function GetWindowRect Lib "user32" (ByVal hwnd As Long, lpRect As RECT) As LongPrivate Declare Function ClipCursor Lib "user32" (lpRect As Any) As LongPrivate Declare Function SetCursorPos Lib "user32" (ByVal x As Long, ByVal y As Long) As LongPrivate Type RECT Left As Long Top As Long Right As Long Bottom As LongEnd TypePrivate Declare Function SetWindowPos Lib "user32" (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal x As Long, ByVal y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As LongPrivate Sub Form_DblClick()EndEnd SubPrivate Sub Form_Load()Timer1.Enabled = TrueTimer1.Interval = 500End SubPrivate Sub Form_Unload(Cancel As Integer)Cancel = 1End Sub'限制鼠标在当前闷旦窗体的区域,而且使当前的窗体始终在最最前面Private Sub Timer1_Timer()Dim ding As RECTSetWindowPos Me.hwnd, -1, 0, 0, 0, 0, 3GetWindowRect Me.hwnd, dingClipCursor dingEnd Sub'限制鼠标在当前窗体的某个点上,这时可以把Timer1.Interval改小点。Private Sub Timer1_Timer()Dim m As Long, n As Longm = 500n = 500SetCursorPos m, nSetWindowPos Me.hwnd, -1, 0, 0, 0, 0, 3End Sub