|
The mini frame window is based on the CMiniFrameWnd class. To create a
mini frame window, first declare a variable or a pointer to CMiniFrameWnd. You can define its class using the
AfxRegisterWndClass() function. You can then pass the return value of that function to its
Create() method. The syntax of this method is:
virtual BOOL Create(
LPCTSTR lpClassName,
LPCTSTR lpWindowName,
DWORD dwStyle,
const RECT& rect,
CWnd* pParentWnd = NULL,
UINT nID = 0
);
The lpClassName parameter should be a value returned from the AfxRegisterWndClass() function.
The lpWindowName is the caption displayed in the title bar of the window.
The dwStyle parameter is the style to apply to the window. Normally, it would use the regular styles of a normal window but many styles are invalid. For example, whether you add the
Minimize and the Maximize buttons or not, they cannot be displayed. You should use only the following combination:
WS_POPUP | WS_CAPTION | WS_SYSMENU. Besides the regular window styles, you should combine them with one or more of the following special styles:
- MFS_MOVEFRAME: With this style, if the user clicks and drags one (any) edge of the frame, the frame would start moving with the same reaction as if the user were dragging the title bar. If you apply this style, the user cannot resize the frame even if another style would allow it
- MFS_4THICKFRAME: This style prevents the user from resizing the
mini frame
- MFS_SYNCACTIVE: This style makes sure that the mini frame is activated when its parent window is activated
- MFS_THICKFRAME: This creates a thick frame and allows the user to resize it if necessary, provided the
MFS_MOVEFRAME is not used
- MFS_BLOCKSYSMENU: This disables access to the system menu
The rect parameter specifies the location and dimensions of the frame window.
The pParentWnd argument is the CWnd parent of the window. This argument is not required.
The nID argument is the identifier of the mini frame window. It is not required.
Besides the Create() method, the CMiniFrameWnd class also provides the
CreateEx() member function to create a mini frame window.
Here is an example:
|