home *** CD-ROM | disk | FTP | other *** search
- VERSION 2.00
- Begin Form moveit
- BorderStyle = 3 'Fixed Double
- Caption = "Cursor Position Example"
- ClientHeight = 6120
- ClientLeft = 1680
- ClientTop = 1605
- ClientWidth = 7245
- Height = 6525
- Left = 1620
- LinkTopic = "Form1"
- MaxButton = 0 'False
- MinButton = 0 'False
- ScaleHeight = 6120
- ScaleWidth = 7245
- Top = 1260
- Width = 7365
- Begin CommandButton Command4
- Caption = "Command4"
- Height = 525
- Left = 5490
- TabIndex = 3
- Top = 480
- Width = 1245
- End
- Begin CommandButton Command3
- Caption = "Command3"
- Height = 525
- Left = 5490
- TabIndex = 2
- Top = 5070
- Width = 1245
- End
- Begin CommandButton Command2
- Caption = "Command2"
- Height = 525
- Left = 540
- TabIndex = 1
- Top = 5070
- Width = 1245
- End
- Begin CommandButton Command1
- Caption = "Command1"
- Height = 525
- Left = 540
- TabIndex = 0
- Top = 480
- Width = 1245
- End
- Declare Sub ClientToScreen Lib "User" (ByVal hWnd As Integer, lpPoint As POINTAPI)
- Declare Sub SetCursorPos Lib "User" (ByVal X As Integer, ByVal Y As Integer)
- Sub Command1_Click ()
- Dim P As POINTAPI
- SaveMode% = Me.ScaleMode
- Me.ScaleMode = 3
- P.X = Command2.Left + (Command2.Width) / 2
- P.Y = Command2.Top + (Command2.Height) / 2
- ClientToScreen Me.hWnd, P
- SetCursorPos P.X, P.Y
- Me.ScaleMode = SaveMode%
- End Sub
- Sub Command2_Click ()
- Dim P As POINTAPI
- SaveMode% = Me.ScaleMode
- Me.ScaleMode = 3
- P.X = Command3.Left + (Command3.Width) / 2
- P.Y = Command3.Top + (Command3.Height) / 2
- ClientToScreen Me.hWnd, P
- SetCursorPos P.X, P.Y
- Me.ScaleMode = SaveMode%
- End Sub
- Sub Command3_Click ()
- Dim P As POINTAPI
- SaveMode% = Me.ScaleMode
- Me.ScaleMode = 3
- P.X = Command4.Left + (Command4.Width) / 2
- P.Y = Command4.Top + (Command4.Height) / 2
- ClientToScreen Me.hWnd, P
- SetCursorPos P.X, P.Y
- Me.ScaleMode = SaveMode%
- End Sub
- Sub Command4_Click ()
- Dim P As POINTAPI
- SaveMode% = Me.ScaleMode
- Me.ScaleMode = 3
- P.X = Command1.Left + (Command1.Width) / 2
- P.Y = Command1.Top + (Command1.Height) / 2
- ClientToScreen Me.hWnd, P
- SetCursorPos P.X, P.Y
- Me.ScaleMode = SaveMode%
- End Sub
- Sub Form_Load ()
- Dim Msg
- Beep
- Msg = " Cursor Position Example" + Chr$(13)
- Msg = Msg & " 1993 by Mark Wisecarver" + Chr$(13) + Chr$(10)
- Msg = Msg & Chr$(10) + "This will show you how to position" + Chr$(13)
- Msg = Msg & Chr$(10) + "the cursor on your apps using API declarations." + Chr$(13) + Chr$(10)
- Msg = Msg & Chr$(10) + "I can be reached via FrontDoor at 1:2380/410.0" + Chr$(13)
- Msg = Msg & Chr$(10) + "or on CompuServe at 72400,505." + Chr$(13)
- Msg = Msg & Chr$(10) + "________________________________________" + Chr$(13) + Chr$(10)
- Msg = Msg & Chr$(10) + "The Visual Basic Depot, Mark Wisecarver" + Chr$(13)
- Msg = Msg & Chr$(10) + "Flatrock, Michigan U.S.A." + Chr$(13)
- MsgBox Msg
- If WindowState = 0 Then
- Move (Screen.Width - Me.Width) / 2, (Screen.Height - Me.Height) / 2
- End If
- Show
- End Sub
-