Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17


Code for office bar, nexus with api's

Posted on 1999-06-22
Medium Priority
Last Modified: 2010-05-02
I'm doing a program in VB 5.0, but the question is How can I do a desktop bar like office, with command buttons to call other procedures?
You know, that bar in your desktop, with the ability of auto resize in every one of 4 borders of the screen.
Can you send me the code for this?
ps. Hope that my question will be easy.
Question by:gads
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

Expert Comment

ID: 1519033

A slightly simpler version is available at:
"Create a Dockable, AutoHide AppBar"

Good luck - Bob Hamilton


Accepted Solution

stewfidgeon earned 100 total points
ID: 1519034
There's plenty of examples of this on planet sourcecode

Here is one example:


'Windows API/Global Declarations for :32-bit Floating Toolbar (NT

'     & 95)


' Place this code into a module

Public Const GWL_HWNDPARENT = (-8)

Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long


' Name: 32-bit Floating Toolbar (NT & 95)

' Description:This code gives you the ability to create a 'floati

'     ng toolbar' within your application. The old SetWindowWord functi

'     on is only good for 16-bit applications, so it won't run under a

'     32-bit OS (like NT4). The API call you should use if you are prog

'     ramming a 32-bit application is SetWindowLong. It works the same

'     way as SetWindowWord, only uses DWORD(Long) values instead of WOR

'     D values for 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 Form1 (giving it a 'floatin

'     g toolbar' effect)


'Assumes:This function will make a form a 'child window' of any f

'     orm you specify.


'Side Effects:Won't work with 16-bit OS's. Use SetWindowWord for

'     16-bit.


'Code provided by Planet Source Code(tm) (http://www.Planet-Sourc

' 'as is', without warranties as to performance, fitnes

'     s, merchantability,and any other warranty (whether expressed or i

'     mplied).

'This code is for personal private or personal business use only

'     and may not be redistributed or duplicated in any format without

'     express written consent from Planet Source Code or Exhedra Soluti

'     ons, Inc.


' Place this code in the General Declarations section of Form1.

Private Sub Command1_Click()

    'Open the toolbar window


        '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


Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses

721 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question