Visual C++ and MFC Fundamentals Chapter 12: Dialog-Based Windows
WS_EX_TOOLWINDOW: A tool window is a parent object mostly used to float, like a
toolbar, on a frame of another window. It has a short title bar that displays its caption. It
can neither be minimized nor maximized but it can be equipped with a circumstantial
system menu:
To create a tool window, when designing the dialog box, check the Tool Window check
box or set it to True. This can also be applied by adding the WS_EX_TOOLWINDOW
extended style:
IDD_SCHOOL_SURVEY DIALOGEX 0, 0, 340, 268
STYLE WS_CAPTION | WS_SYSMENU | WS_POPUP | DS_MODALFRAME
EXSTYLE WS_EX_TOOLWINDOW
CAPTION “School Survey – For Teachers Only”
FONT 8, “MS Shell Dlg”, 400, 0, 0x1
If you want the user to be able to resize the tool window by dragging its borders or
corners, at design time, set its Border value to Resizing or create it with the
WS_THICKFRAME style. If you do not want the user to be able to resize the tool
window, at design time, set its Border to either Thin or Dialog Frame. In the resource file,
you can also do this by creating it with the WS_CAPTION and WS_SYSMENU style:
INT WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
LPSTR lpCmdLine, int nCmdShow)
{
HWND hWnd;
MSG Msg;
WNDCLASSEX WndClsEx;
...
RegisterClassEx(&WndClsEx);
hWnd = CreateWindowEx(WS_EX_TOOLWINDOW,
ClsName,
WndName,
WS_CAPTION | WS_SYSMENU,
.. .,
);
}
WS_EX_APPWINDOW: As mentioned already, a window without the system
Minimize button cannot be minimized. This, of course, is the same for a tool window.
Also, by default, a tool window does not display a button on the taskbar. If you are
creating a window that will depend on a main window such as a frame, you should keep