Registering an Application Desktop Toolbar

An application must register an appbar by sending the ABM_NEW message. Registering an appbar adds it to the system's internal list and provides the system with a message identifier to use to send notification messages to the appbar. Before exiting, an application must unregister the appbar by sending the ABM_REMOVE message. Unregistering removes the appbar from the system's internal list and prevents the bar from receiving appbar notification messages.

The function in the following example either registers or unregisters an appbar, depending on the value of a Boolean flag parameter.

// RegisterAccessBar - registers or unregisters an appbar.

// Returns TRUE if successful or FALSE otherwise.

// hwndAccessBar - handle of the appbar

// fRegister - register and unregister flag

//

// Global variables

// g_uSide - screen edge (defaults to ABE_TOP)

// g_fAppRegistered - flag indicating whether the bar is registered

BOOL RegisterAccessBar(HWND hwndAccessBar, BOOL fRegister)

{

APPBARDATA abd;

// Specify the structure size and handle of the appbar.

abd.cbSize = sizeof(APPBARDATA);

abd.hWnd = hwndAccessBar;

if (fRegister) {

// Provide an identifier for notification messages.

abd.uCallbackMessage = APPBAR_CALLBACK;

// Register the appbar.

if (!SHAppBarMessage(ABM_NEW, &abd))

return FALSE;

g_uSide = ABE_TOP; // default edge

g_fAppRegistered = TRUE;

} else {

// Unregister the appbar.

SHAppBarMessage(ABM_REMOVE, &abd);

g_fAppRegistered = FALSE;

}

return TRUE;

}

Software for developers
Delphi Components
.Net Components
Software for Android Developers
More information resources
MegaDetailed.Net
Unix Manual Pages
Delphi Examples
Databases for Amazon shops developers
Amazon Categories Database
Browse Nodes Database