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

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 http://www.planet-source-code.com/vb/

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

'     e-Code.com) '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

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

597 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