CMiniFrameWnd Class

Represents a half-height frame window typically seen around floating toolbars.

Syntax

class CMiniFrameWnd : public CFrameWnd

Members

Public Constructors

Name Description
CMiniFrameWnd::CMiniFrameWnd Constructs a CMiniFrameWnd object.

Public Methods

Name Description
CMiniFrameWnd::Create Creates a CMiniFrameWnd object after construction.
CMiniFrameWnd::CreateEx Creates a CMiniFrameWnd object (with additional options) after construction.

Remarks

These mini-frame windows behave like normal frame windows, except that they do not have minimize/maximize buttons or menus and you only have to single-click on the system menu to dismiss them.

To use a CMiniFrameWnd object, first define the object. Then call the Create member function to display the mini-frame window.

For more information on how to use CMiniFrameWnd objects, see the article Docking and Floating Toolbars.

Inheritance Hierarchy

CObject

CCmdTarget

CWnd

CFrameWnd

CMiniFrameWnd

Requirements

Header: afxwin.h

CMiniFrameWnd::CMiniFrameWnd

Constructs a CMiniFrameWnd object, but does not create the window.

CMiniFrameWnd();

Remarks

To create the window, call CMiniFrameWnd::Create.

CMiniFrameWnd::Create

Creates the Windows mini-frame window and attaches it to the CMiniFrameWnd object.

virtual BOOL Create(
    LPCTSTR lpClassName,
    LPCTSTR lpWindowName,
    DWORD dwStyle,
    const RECT& rect,
    CWnd* pParentWnd = NULL,
    UINT nID = 0);

Parameters

lpClassName
Points to a null-terminated character string that names the Windows class. The class name can be any name registered with the global AfxRegisterWndClass function. If NULL, the window class will be registered for you by the framework. MFC gives the default class the following styles and attributes:

  • Sets style bit CS_DBLCLKS, which sends double-click messages to the window procedure when the user double-clicks the mouse.

  • Sets style bits CS_HREDRAW and CS_VREDRAW, which direct the contents of the client area to be redrawn when the window changes size.

  • Sets the class cursor to the Windows standard IDC_ARROW.

  • Sets the class background brush to NULL, so the window will not erase its background.

  • Sets the class icon to the standard, waving-flag Windows logo icon.

  • Sets the window to the default size and position, as indicated by Windows.

lpWindowName
Points to a null-terminated character string that contains the window name.

dwStyle
Specifies the window style attributes. These can include standard window styles and one or more of the following special styles:

  • MFS_MOVEFRAME Allows the mini-frame window to be moved by clicking on any edge of the window, not just the caption.

  • MFS_4THICKFRAME Disables resizing of the mini-frame window.

  • MFS_SYNCACTIVE Synchronizes the activation of the mini-frame window to the activation of its parent window.

  • MFS_THICKFRAME Allows the mini-frame window to be sized as small as the contents of the client area allow.

  • MFS_BLOCKSYSMENU Disables access to the system menu and the control menu, and converts them to part of the caption (title bar).

See CWnd::Create for a description of possible window style values. The typical combination used for mini-frame windows is WS_POPUP|WS_CAPTION|WS_SYSMENU.

rect
A RECT structure specifying the desired dimensions of the window.

pParentWnd
Points to the parent window. Use NULL for top-level windows.

nID
If the mini-frame window is created as a child window, this is the identifier of the child control; otherwise 0.

Return Value

Nonzero if successful; otherwise 0.

Remarks

Create initializes the window's class name and window name and registers default values for its style and parent.

CMiniFrameWnd::CreateEx

Creates a CMiniFrameWnd object.

virtual BOOL CreateEx(
    DWORD dwExStyle,
    LPCTSTR lpClassName,
    LPCTSTR lpWindowName,
    DWORD dwStyle,
    const RECT& rect,
    CWnd* pParentWnd = NULL,
    UINT nID = 0);

Parameters

dwExStyle
Specifies the extended style of the CMiniFrameWnd being created. Apply any of the extended window styles to the window.

lpClassName
Points to a null-terminated character string that names the Windows class (a WNDCLASS structure). The class name can be any name registered with the global AfxRegisterWndClass function or any of the predefined control-class names. It must not be NULL.

lpWindowName
Points to a null-terminated character string that contains the window name.

dwStyle
Specifies the window style attributes. See Window Styles and CWnd::Create for a description of the possible values.

rect
The size and position of the window, in client coordinates of pParentWnd.

pParentWnd
Points to the parent window object.

nID
The identifier of the child window.

Return Value

Returns TRUE on success, FALSE on failure.

Remarks

The CreateEx parameters specify the WNDCLASS, window style, and (optionally) initial position and size of the window. CreateEx also specifies the window's parent (if any) and ID.

When CreateEx executes, Windows sends the WM_GETMINMAXINFO, WM_NCCREATE, WM_NCCALCSIZE, and WM_CREATE messages to the window.

To extend the default message handling, derive a class from CMiniFrameWnd, add a message map to the new class, and provide member functions for the above messages. Override OnCreate, for example, to perform needed initialization for a new class.

Override further OnMessage message handlers to add further functionality to your derived class.

If the WS_VISIBLE style is given, Windows sends the window all the messages required to activate and show the window. If the window style specifies a title bar, the window title pointed to by the lpszWindowName parameter is displayed in the title bar.

The dwStyle parameter can be any combination of window styles.

The old style Palette toolbox windows are no longer supported. The old style, which did not have an "X" Close button, was supported when running an MFC application on previous versions of Windows, but is no longer supported in Visual C++.NET. Only the new WS_EX_TOOLWINDOW style is now supported; for a description of this style, see Extended Window Styles.

See also

CFrameWnd Class
Hierarchy Chart
CFrameWnd Class