Private 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 Long
'Sets the position of the window
Private Declare Function SetParent Lib "user32" (ByVal hWndChild As Long, ByVal hWndNewParent As Long) As Long
'Set the parent of ANY object (can be lots of fun! ;-)
Private Declare Function GetParent Lib "user32" (ByVal hwnd As Long) As Long
'Get the hWnd of the object's parent
Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
'Get the current cursor Hot-Spot position
Private Type POINTAPI
X As Long
Y As Long
End Type
Const a_Radius = 30 'Acceptable Radius the cursor can be
'within for the button to 'grab' the cursor
Const HWND_TOPMOST = -1
Dim XnY As POINTAPI, ExitDo As Boolean
Private Sub cmdNoBut_Click()
cmdYesBut.ZOrder 0 'Set the follower button to infront
tmrFollow.Enabled = True 'Start the button moving!
End Sub
Private Sub cmdYesBut_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
'The Click event doesn't work when the button's parent is set to None
ExitDo = True
'Stop the Do..Loop from running, though you don't need
'this if you're going to unload the form like this
If GetParent(cmdYesBut.hwnd) <> Me.hwnd Then cmdYesBut.Visible = False
'If the parent was set to anything other than the form
'then make it invisible, so it wont get infront of the