You are on page 1of 1

' Place this in a module:

Public Const GWL_HWNDPARENT = (-8)


Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd A
s Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
'Place this in a form:
Private Sub Command1_Click()
'Open the toolbar window
Form2.Show
'Move the toolbar to the right
'of Form1.
'(gives it a docking effect)
Form2.Height = Form1.Height - 330
'Subtract the titlebar height -^
Form2.Left = Form1.Left + Form1.Width - Form2.Width
Form2.Top = Form1.Top + Form1.Height - Form2.Height
End Sub
'On Form1, place a Command button (Command1)
'On Form2, Set the Window Style To 4-FixedToolWindow (not nessesary)

Private Sub Form_Load()


'Set the button properties
Command1.Caption = "Show Toolbar"
Command1.Width = 2055
Command1.Height = 375
End Sub
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
'If Form2 is opened when you close
'Form1, it will not end your app, so
'you have to manually unload Form2.
Unload Form2
End Sub
' Place this code in the Form_Load event
'
of Form2
Private Sub Form_Load()
SetWindowLong Me.hwnd, GWL_HWNDPARENT, Form1.hwnd
End Sub

You might also like