home *** CD-ROM | disk | FTP | other *** search
- VERSION 2.00
- Begin Form VBEX017
- Caption = "VISUAL BASICS #17 - Moving the Mouse"
- ClientHeight = 675
- ClientLeft = 1635
- ClientTop = 3375
- ClientWidth = 5100
- Height = 1080
- Left = 1575
- LinkMode = 1 'Source
- LinkTopic = "Form1"
- ScaleHeight = 675
- ScaleWidth = 5100
- Top = 3030
- Width = 5220
- Begin CommandButton Command2
- Cancel = -1 'True
- Caption = "Quit"
- Height = 375
- Left = 3840
- TabIndex = 3
- Top = 120
- Width = 975
- End
- Begin CommandButton Command1
- Caption = "Fast"
- Default = -1 'True
- Height = 375
- Index = 2
- Left = 2640
- TabIndex = 2
- Top = 120
- Width = 975
- End
- Begin CommandButton Command1
- Caption = "Medium"
- Height = 375
- Index = 1
- Left = 1440
- TabIndex = 1
- Top = 120
- Width = 975
- End
- Begin CommandButton Command1
- Caption = "Slow"
- Height = 375
- Index = 0
- Left = 240
- TabIndex = 0
- Top = 120
- Width = 975
- End
- Sub Command1_Click (Index As Integer)
-
- Speed% = (Index * 10) + 1 ' INDEX SETS THE SPEED OF THE MOUSE.
- ' the higher the index, the fewer the
- ' DoEvents() calls, hence the higher the speed.
- ' We add one to avoid a DIVIDE BY ZERO error.
- 'RESTORES CURSOR TO FULL SCREEN
- CursorRect.Top = 0
- CursorRect.Left = 0
- CursorRect.right = ScreenWidth
- CursorRect.Bottom = ScreenHeight
- ClipCursor CursorRect
- SetCurSorPos 400, 300
- For X% = 0 To ScreenWidth ' left to right
- CursorRect.Top = 200
- CursorRect.Left = X%
- CursorRect.right = CursorRect.Left
- CursorRect.Bottom = CursorRect.Top
- ClipCursor CursorRect
- SetCurSorPos 0, 0
- If X% Mod Speed% = 0 Then D% = DoEvents()
- Next X%
-
- For X% = ScreenWidth To 0 Step -1 'Right To Left
- CursorRect.Top = 200
- CursorRect.Left = X%
- CursorRect.right = CursorRect.Left
- CursorRect.Bottom = CursorRect.Top
- ClipCursor CursorRect
- SetCurSorPos 0, 0
- If X% Mod Speed% = 0 Then D% = DoEvents()
- Next X%
- For Y% = 0 To ScreenHeight 'top to bottom
- CursorRect.Top = Y%
- CursorRect.Left = 250
- CursorRect.right = CursorRect.Left
- CursorRect.Bottom = CursorRect.Top
- ClipCursor CursorRect
- SetCurSorPos 0, 0
- If X% Mod Speed% = 0 Then D% = DoEvents()
- Next Y%
- For Y% = ScreenHeight To 0 Step -1
- CursorRect.Top = Y%
- CursorRect.Left = 250
- CursorRect.right = CursorRect.Left
- CursorRect.Bottom = CursorRect.Top
- ClipCursor CursorRect
- SetCurSorPos 0, 0
- If X% Mod Speed% = 0 Then D% = DoEvents()
- Next Y%
- CursorRect.Top = 0
- CursorRect.Left = 0
- CursorRect.right = ScreenWidth
- CursorRect.Bottom = ScreenHeight
- ClipCursor CursorRect
- SetCurSorPos ScreenWidth / 2, ScreenHeight / 2
- End Sub
- Sub Command2_Click ()
- CursorRect.Top = 0
- CursorRect.Left = 0
- CursorRect.right = screen.Width / 15
- CursorRect.Bottom = screen.Height / 15
- ClipCursor CursorRect
- End
- End Sub
- Sub Form_Load ()
- ScreenHeight = screen.Height / 15
- ScreenWidth = screen.Width / 15
- End Sub
- Sub Form_MouseUp (Button As Integer, Shift As Integer, X As Single, Y As Single)
- MousePressed = 0
- End Sub
-