ID: Q81814
ToolBox.exe is a file in the Microsoft Software Library that demonstrates how to implement a tool box window in an application. The Image Editor and the Dialog Editor are two applications provided with the Windows SDK that demonstrate a "tool box" window.
The following file is available for download from the Microsoft Software Library:
~ ToolBox.exe (size: 26087 bytes)
For more information about downloading files from the Microsoft Software
Library, please see the following article in the Microsoft Knowledge Base:
ARTICLE-ID: Q119591
TITLE : How to Obtain Microsoft Support Files from Online Services
A tool box window contains a group of icons that the user can choose at any
time. The tool box window always floats above the application with which it
is associated.
The code in TOOLBOX assumes that all buttons in the tool box have the same size and are equally spaced throughout the window. TOOLBOX implements the following four steps to create the tool box window:
1. Loads the bitmap that provides the visual appearance for all the
buttons.
2. Creates the tool box window with the WS_EX_TOPMOST style bit set.
Sizes the window appropriately based on the size of the bitmap.
3. Processes the WM_ACTIVATE message in the window procedure for the
application's main window. If the main window or the tool box
window is being activated, TOOLBOX calls SetWindowPos() to add the
WS_EX_TOPMOST style to the window. If a window other than the main
window or the tool box window is being activated, TOOLBOX calls
SetWindowPos() to remove the WS_EX_TOPMOST style from the window.
4. Performs the following two steps in the window procedure for the
tool box window:
a. Processes the WM_LBUTTONDOWN message. Performs hit testing to
determine which button the user chose. To make the button appear
depressed, TOOLBOX determines the rectangle for the button.
TOOLBOX uses the InvertRect function to invert the colors of the
button.
b. Processes the WM_PAINT message. TOOLBOX uses the StretchBlt()
function to paint the bitmap onto the window. If any button is
depressed, TOOLBOX inverts the appropriate region as above.
Although this sample does not demonstrate every possibility for tool
box windows, the sample is very straightforward and easily modified.
Additional query words: Keywords : kbfile kbsample kb16bitonly kbGrpUser kbWinOS310 kbWndw kbWndwMsg kbWndwProp
Last Reviewed: December 24, 1998