home *** CD-ROM | disk | FTP | other *** search
- VERSION 4.00
- Begin VB.Form Form1
- Caption = "Form1"
- ClientHeight = 2280
- ClientLeft = 3105
- ClientTop = 7080
- ClientWidth = 5145
- Height = 2685
- Left = 3045
- LinkTopic = "Form1"
- ScaleHeight = 2280
- ScaleWidth = 5145
- Top = 6735
- Width = 5265
- Begin VB.CommandButton Command2
- Caption = "Command2"
- Height = 495
- Left = 2520
- TabIndex = 1
- Top = 960
- Width = 1215
- End
- Begin VB.CommandButton Command1
- Caption = "Command1"
- Height = 495
- Left = 840
- TabIndex = 0
- Top = 960
- Width = 1215
- End
- Attribute VB_Name = "Form1"
- Attribute VB_Creatable = False
- Attribute VB_Exposed = False
- Private Type POINTAPI
- x As Long
- y As Long
- End Type
- Private Type RECT
- left As Long
- top As Long
- Right As Long
- Bottom As Long
- End Type
- Private Declare Function SetCursorPos Lib "user32" _
- (ByVal x As Long, ByVal y As Long) As Long
- Private Declare Function GetWindowRect Lib "user32" _
- (ByVal hwnd As Long, lpRect As RECT) As Long
- Dim p As POINTAPI
- Dim r As RECT
- Dim rWidth As Long, rHeight As Long
- Private Sub Command1_Click()
- GetWindowRect Command2.hwnd, r
- rWidth = r.Right - r.left
- rHeight = r.Bottom - r.top
- SetCursorPos r.left + (rWidth / 2), r.top + (rHeight / 2)
- End Sub
- Private Sub Command2_Click()
- GetWindowRect Command1.hwnd, r
- rWidth = r.Right - r.left
- rHeight = r.Bottom - r.top
- SetCursorPos r.left + (rWidth / 2), r.top + (rHeight / 2)
- End Sub
-