Here's an example a little more relevant to want you wanted. It shows two forms and when either one is moved it moves the other one to stay "attached" to it.
Private Declare Function CallWindowProc Lib "user32" Alias "CallWindowProcA" _
(ByVal lpPrevWndFunc As Long, _
ByVal hWnd As Long, _
ByVal Msg As Long, _
ByVal wParam As Long, _
ByVal lParam As Long) As Long
Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" _
(ByVal hWnd As Long, _
ByVal nIndex As Long, _
ByVal dwNewLong As Long) As Long
Private Const GWL_WNDPROC = -4
Private Const WM_MOVE = &H3
Private lpPrevWndProc1 As Long
Private lpPrevWndProc2 As Long
Private hWnd1 As Long
Private hWnd2 As Long
Function WindowProc(ByVal hw As Long, _
ByVal uMsg As Long, _
ByVal wParam As Long, _
ByVal lParam As Long) As Long
If hw = hWnd1 Then
If uMsg = WM_MOVE Then Form2.Move Form1.Left + Form1.Width, Form1.Top
WindowProc = CallWindowProc(lpPrevWndProc1, hw, uMsg, wParam, lParam)
Else
If uMsg = WM_MOVE Then Form1.Move Form2.Left - Form2.Width, Form2.Top
WindowProc = CallWindowProc(lpPrevWndProc2, hw, uMsg, wParam, lParam)
End If
End Function
Private Sub main()
Load Form1
Load Form2
hWnd1 = Form1.hWnd
hWnd2 = Form2.hWnd
lpPrevWndProc1 = SetWindowLong(hWnd1, GWL_WNDPROC, AddressOf WindowProc)
lpPrevWndProc2 = SetWindowLong(hWnd2, GWL_WNDPROC, AddressOf WindowProc)
Form1.Show
Form2.Show
End Sub