VERSION 5.00
Begin VB.Form Form1 
   Caption         =   "Form1"
   ClientHeight    =   3195
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   4680
   LinkTopic       =   "Form1"
   ScaleHeight     =   213
   ScaleMode       =   3  'Pixel
   ScaleWidth      =   312
   StartUpPosition =   3  'Windows Default
   Begin VB.Timer Timer1 
      Interval        =   1
      Left            =   600
      Top             =   1800
   End
   Begin VB.CommandButton Command1 
      Caption         =   "Command1"
      Height          =   495
      Left            =   1800
      TabIndex        =   0
      Top             =   1320
      Width           =   1215
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Declare Function ClientToScreen Lib "user32" (ByVal hwnd As Long, lpPoint As POINTAPI) As Long
Private Declare Function ScreenToClient Lib "user32" (ByVal hwnd As Long, lpPoint As POINTAPI) As Long
Private Type POINTAPI
    X As Long
    Y As Long
End Type

'Holds the position of the button on the screen
Dim ButtonPos As POINTAPI

'Holds the last position of the form.  It's used to detect whether
'the form has moved since the last tick of the timer
Dim OldTop&, OldLeft&

Private Sub Form_Load()
'Find out the position of the button on the screen
ButtonPos.X = Command1.Left
ButtonPos.Y = Command1.Top
ClientToScreen Me.hwnd, ButtonPos
End Sub

Private Sub Timer1_Timer()
'Holds the position Command1 will be moved to on the form
Dim PT As POINTAPI
If Me.Top <> OldTop Or Me.Left <> OldLeft Then
OldTop = Me.Top
OldLeft = Me.Left

'Put the button in its place
PT = ButtonPos
ScreenToClient Me.hwnd, PT
Command1.Left = PT.X
Command1.Top = PT.Y

End If
End Sub
