32-bit Floating Toolbar
'************************************** ' Name: 32-bit Floating Toolbar (NT & 95 ' ) ' Description:This code gives you the ab ' ility to create a 'floating toolbar' wit ' hin your application. The old SetWindowW ' ord function is only good for 16-bit app ' lications, so it won't run under a 32-bi ' t OS (like NT4). The API call you should ' use if you are programming a 32-bit appl ' ication is SetWindowLong. It works the s ' ame way as SetWindowWord, only uses DWOR ' D(Long) values instead of WORD values fo ' r the 32-bit OS. ' By: Mike Jones ' ' Inputs:You will need to create 2 forms ' (Form1 & Form2). On Form1, place a Command button (Command1) On Form2, Set the Window Style To 4-FixedToolWindow (not nessesary) ' ' Returns:Sets Form2 to be a child of Fo ' rm1 (giving it a 'floating toolbar' effe ' ct) ' ' Assumes:This function will make a form ' a 'child window' of any form you specify ' . ' ' Side Effects:Won't work with 16-bit OS 's. Use SetWindowWord for 16-bit. ' 'This code is copyrighted and has' limited warranties.Please see http://w ' ww.Planet-Source-Code.com/xq/ASP/txtCode ' Id.1146/lngWId.1/qx/vb/scripts/ShowCode. ' htm'for details.'************************************** ' Place this code in the General Declara ' tions section of Form1. 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 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