To Create an application desktop tool bar
This Section is also Shell concept implemented thing and the main functionality in this section is creating another tool bar to be displayed in the desktop. The tool bar is same as the TaskBar in desktop but it is displayed using the Shell concept. The UI has been created first and the section of the bar is displayed in the desktop.
The Desktop Application ToolBar is created in such a way that it is displayed in the appropriate place which is calculated by the OS. The Shell commands intereacts with the OS and the OS checks with the compatibility of displaying the tool bar in the desktop.
Then after displaying the Task Bar has three radio buttons to select on which area it has to be displayed. Like TOP,BOTTOM,LEFT,RIGHT according to the selection the tool bar is displayed.
To display the application tool bar the toolbar has to be registered. The registration is done by sending the message AppBarMessages.New. when this message is sent the following members of the APPBARDATA struct should be set. the hWnd should be set to our window handle, the uCallbackMessage should be set to a unique message id that the OS will use to communicate with our program.
We can set the AppBar Size and location and they are passed to OS which will check with other objects, to not to disturb their display in the desktop.
The Sample Code is attached for creating the Application Desktop ToolBar.
public class ApplicationDesktopToolbarDemo : Form
public enum AppBarMessagesDemo
/// Registers a new appbar and specifies the message identifier
/// that the system should use to send notification messages to
/// the appbar.
NewBar = 0x00000000,
/// Unregisters an appbar, removing the bar from the system's
/// internal list.
RemoveBar = 0x00000001,
/// Requests a size and screen position for an appbar.
QueryPosition = 0x00000002,
/// Sets the size and screen position of an appbar.
SetPosition = 0x00000003,
/// Retrieves the autohide and always-on-top states of the
/// Microsoft® Windows® taskbar.
GetStateOfBar = 0x00000004,
/// Retrieves the bounding rectangle of the Windows taskbar.
GetTaskBarPos = 0x00000005,
/// Notifies the system that an appbar has been activated.
ActivateBar = 0x00000006,
/// Retrieves the handle to the autohide appbar associated with
/// a particular edge of the screen.
GetAutoHideBar = 0x00000007,
/// Registers or unregisters an autohide appbar for an edge of
/// the screen.
SetAutoHideBar = 0x00000008,
/// Notifies the system when an appbar's position has changed.
WindowPosChanged = 0x00000009,
/// Sets the state of the appbar's autohide and always-on-top
SetState = 0x0000000a
public enum AppBarNotificationsDemo
/// Notifies an appbar that the taskbar's autohide or
/// always-on-top state has changed—that is, the user has selected
/// or cleared the "Always on top" or "Auto hide" check box on the
/// taskbar's property sheet.
StateChangeofBar = 0x00000000,
/// Notifies an appbar when an event has occurred that may affect
/// the appbar's size and position. Events include changes in the
/// taskbar's size, position, and visibility state, as well as the
/// addition, removal, or resizing of another appbar on the same
/// side of the screen.
PosChanged = 0x00000001,
/// Notifies an appbar when a full-screen application is opening or
/// closing. This notification is sent in the form of an
/// application-defined message that is set by the ABM_NEW message.
FullScreenApp = 0x00000002,
/// Notifies an appbar that the user has selected the Cascade,
/// Tile Horizontally, or Tile Vertically command from the
/// taskbar's shortcut menu.
WindowArrange = 0x00000003
public enum AppBarStates
AutoHide = 0x00000001,
AlwaysOnTop = 0x00000002
public enum AppBarEdges
Left = 0,
Top = 1,
Right = 2,
Bottom = 3,
Float = 4
// Window Messages
public enum WM
ACTIVATE = 0x0006,
WINDOWPOSCHANGED = 0x0047,
NCHITTEST = 0x0084
public enum MousePositionCodes
HTERROR = (-2),
HTTRANSPARENT = (-1),
HTNOWHERE = 0,
HTCLIENT = 1,
HTCAPTION = 2,
HTSYSMENU = 3,
HTGROWBOX = 4,
HTSIZE = HTGROWBOX,
HTMENU = 5,
HTHSCROLL = 6,
HTVSCROLL = 7,
HTMINBUTTON = 8,
HTMAXBUTTON = 9,
HTLEFT = 10,
HTRIGHT = 11,
HTTOP = 12,
HTTOPLEFT = 13,
HTTOPRIGHT = 14,
HTBOTTOM = 15,
HTBOTTOMLEFT = 16,
HTBOTTOMRIGHT = 17,
HTBORDER = 18,
HTREDUCE = HTMINBUTTON,
HTZOOM = HTMAXBUTTON,
HTSIZEFIRST = HTLEFT,
HTSIZELAST = HTBOTTOMRIGHT,
HTOBJECT = 19,
HTCLOSE = 20,
HTHELP = 21
In this section the Application tool bar is been created using the ApplicationToolBarDemo function and the Bar is registered with the OS so as to display them in the desktop.
The Parameters are passed to the OS which processes the data parameters and sets the ToolBar in the Desktop window.
The Size and Postion of the Toolbar is sent to the OS which changes the display of the Toolbar on the Desktop.
By default the tool bar is displayed in the left corner and the Yahoo Button with the Timer control added in it.
The Toolbar demo has TOP, BOTTOM,LEFT,RIGHT radio buttons which when selected the Bar will be displayed in the appropriate places.
The Figure shows the display of the Bar on the desktop, which is placed in the left corner by default and then the other desktop controls are displayed next to it.
The shell commands passed the parameters to OS and then the bar is displayed in the Desktop without disturbing the other controls.
The Above figure Shows the Application Desktop ToolBar which is executed and displayed in the desktop. That has the timer added in them. Yahoo button is also there which when clicked the yahoo website will be opened.
The Yahoo button in this section implements the SectionSecond Shell Concept of file operations and opens IE for yahoo website.
Conclusion for Third Section
Using C# we can extend Shell application to create a Desktop application tool bar with timer and a Button.