15 мая 2023 года "Исходники.РУ" отмечают своё 23-летие!
Поздравляем всех причастных и неравнодушных с этим событием!
И огромное спасибо всем, кто был и остаётся с нами все эти годы!

Главная Форум Журнал Wiki DRKB Discuz!ML Помощь проекту


Client Area of MDI Frame.

Willie Lyons -- willie@ccohs.ca
Tuesday, April 02, 1996

Using: VC++ 1.52c Windows 3.1/95

I would like my MDI client windows to open so that they use the entire 
client area of the MDI frame window. A call to GetClientRect() returns 
the client area including the tool bar and status bar child windows. This 
makes my MDI clients extend past the bottom of the frame window (Behind 
the status bar). I can not seem to find a way to subtract the tool bar 
and status bar areas from the MDI frame area?

Any help is appresiated.



Dave Brooks -- info@brooksnet.com
Wednesday, April 03, 1996

[Mini-digest: 8 responses]

At 10:48 AM 4/2/96 -0800, Willie Lyons wrote:
>Using: VC++ 1.52c Windows 3.1/95
>
>I would like my MDI client windows to open so that they use the entire 
>client area of the MDI frame window. A call to GetClientRect() returns 
>the client area including the tool bar and status bar child windows. This 
>makes my MDI clients extend past the bottom of the frame window (Behind 
>the status bar). I can not seem to find a way to subtract the tool bar 
>and status bar areas from the MDI frame area?

Call MDIMaximize() on the window's frame.

I hope this helps,
Dave
**************************************************************************
David L. Brooks                             Brooks Internet Software, Inc.
info@brooksnet.com        1-800-523-9175 MST         http://brooksnet.com/
 Home of RPM, a new LPD server for Windows - check the Web page for demo!

-----From: V Gururaj 

Hi there,
	If the MDI client windows that u are using are only of 
type MDIChildWnd, then Use MDIMaximize function while creating
the child window.
	In case of other type of windows,explicit client area
manipulation is needed.
Bye,
GURU.

============================================
V GURURUJA RAO                             |
Silicon Automation Systems (India) Pvt,Ltd.|
Bangalore.                                 |
e-mail : guru@sas.soft.net                 |
	 guru@sasi.ernet.in                |
============================================

-----From: jerry_albro@tcpgate.ibi.com

You say "MDI clients" when I believe you mean "MDI child" windows. The
MDI client window is the window, owned by the MDI Fram, that owns and
controls the child windows. So, try using GetClientRect() on the
window that the frame's m_hWndMDIClient refers to.

Jerry Albro

-----From: Deepak Saxena 

Maybe I'm thinking of a different problem then you, but the easiest way 
to do tihis would be to derive your own CMdiChildWnd based class and 
then overiding PreCreateWindow().  In PreCreateWindow() set the 
WS_MAXIMIZED style of the window, and the window will now be maximized 
when created.

--
Deepak Saxena                          | "I am JJ,          | These opinions are
Deepak_Saxena@ccm.ch.intel.com         |  I am the owner,   | mine and do not in
http://cernan.ecn.purdue.edu/~deepak   |  and I am the king | any way represent 
Home:(602)812-8933, Work:(602)554-1304 |  of beepers!"      | Intel Corporation.

-----From: beriksen@cda.com

     I know that in VC++4.0 on Win3.1,NT,and 95 you can open up the MDI 
     Child windows as Maximized by oring in WS_MAXIMIZE during OnCreate of 
     the MDI Child Frame, but I'm not sure about how this would work under 
     vc1.52c.
     
     Brian Eriksen
     beriksen@cda.com

-----From: "Tom Serface" 

Create a derived MDI frame class like the following:

/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// CMyMDIChildWnd frame

class CMyMDIChildWnd : public CMDIChildWnd
{
	DECLARE_DYNCREATE(CMyMDIChildWnd)
protected:
	CMyMDIChildWnd();			// protected constructor used by dynamic creation

// Attributes
public:

// overrides
public:
	virtual void OnUpdateFrameMenu(BOOL bActive, CWnd* pActivateWnd, HMENU 
hMenuAlt);

// Operations
public:

// Implementation
public:
	BOOL PreCreateWindow(CREATESTRUCT& cs);

protected:
	virtual ~CMyMDIChildWnd();

	// Generated message map functions
	//{{AFX_MSG(CMyMDIChildWnd)
		// NOTE - the ClassWizard will add and remove member functions here.
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()
};

/////////////////////////////////////////////////////////////////////////////


/////////////////////////////////////////////////////////////////////////////
// CMyMDIChildWnd

IMPLEMENT_DYNCREATE(CMyMDIChildWnd, CMDIChildWnd)

CMyMDIChildWnd::CMyMDIChildWnd()
{
}

CMyMDIChildWnd::~CMyMDIChildWnd()
{
}


BEGIN_MESSAGE_MAP(CMyMDIChildWnd, CMDIChildWnd)
	//{{AFX_MSG_MAP(CMyMDIChildWnd)
		// NOTE - the ClassWizard will add and remove mapping macros here.
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

BOOL CMyMDIChildWnd::PreCreateWindow(CREATESTRUCT& cs)
{
	// Create a maximized window without
	// min/max buttons or sizable border, you can put whatever styles you want 
for your MDI child windows here
	cs.style |= WS_MAXIMIZE;
	return CMDIChildWnd::PreCreateWindow(cs);
}

I put these in my main application class files....

Then use it in the setting up of the document templates:

	// Register the application's document templates.  Document templates
	//  serve as the connection between documents, frame windows and views.

	CMultiDocTemplate* pDocTemplate;
	pDocTemplate = new CMultiDocTemplate(
		IDR_CBDWTYPE,
		RUNTIME_CLASS(CCbdwDoc),
		RUNTIME_CLASS(CMyMDIChildWnd),        // standard MDI child frame   
<------------This line changes
		RUNTIME_CLASS(CCbdwView));
	AddDocTemplate(pDocTemplate);


-----From: "Ross De Leon" 

The CMDIFrameWnd class has a public member variable "m_hWndMDIClient". This is 
the window that occupies the client area (background) of the MDI Frame window. 
Try doing the GetClientRect() or GetWindowRect() using this window handle. 
 
Hope this helps. 
 
- Ross 

-----From: Dan Kirby 

It sounds like you want to maximize the  MDI child window when it is 
created.  Is that correct?  If so, override ActivateFrame for CMDIChildWnd. 
 See article Q142317 in the MS Developer Knowledgebase.

--dan




| Вернуться в корень Архива |