The Mini Frame Window |
|
Introduction |
A mini frame is a window that is mostly used as a floating object that accompany another window, the main object of an application. It appears as a normal frame window we have seen so far with borders and a client area but a mini frame window is used a tool instead of as a main window. For this functionality, it does not have the System minimize and maximize buttons. As a tool window, it appears with a short title bar and is equipped with a system close button.
|
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 rect parameter specifies the location and dimensions of the frame window. void CMiniFrame2Dlg::OnBnClickedMiniframeBtn() { // TODO: Add your control notification handler code here CMiniFrameWnd *MFW = new CMiniFrameWnd; CString StrClassName = AfxRegisterWndClass( CS_HREDRAW | CS_VREDRAW | CS_DBLCLKS, LoadCursor(NULL, IDC_ARROW), (HBRUSH)GetStockObject(COLOR_BTNFACE+1), LoadIcon(NULL, IDI_APPLICATION)); MFW->CreateEx(0, StrClassName, TEXT("Small Application"), WS_POPUP | WS_CAPTION | WS_SYSMENU | MFS_BLOCKSYSMENU, CRect(100, 100, 350, 420)); MFW->ShowWindow(SW_SHOW); } |
|
Copyright © 2003-2006 FunctionX, Inc. |
|