🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.windows.misc
Article #407

Re: MSC 7.0 C++ MFC MDI help me please!!

#407
From: Steven Sinofsky
Date: Mon, 05 Oct 1992 01:07
51 lines
2228 bytes
In article <67070@cup.portal.com> JP_Getty_AHIP@cup.portal.com writes:
>I want to create a MDI child that does not have the styles WS_CAPTION
>WS_SYSMODAL WS_MINIMIZEBOX or WS_MAXIMIZEBOX.  MicroSoft says these are
>hard-coded into MFC.  If you can help, please respond. 


This can be done, though the resulting program will only run on
Windows 3.1 (it takes advantage of a new 3.1 feature) and will
be fairly non-standard.

In your MDIFrameWnd's OnCreate member function, where you
usually cal the default implementation of CMDIFrameWnd::CreateClient,
just do this yourself, adding the new MDI style, MDIS_ALLCHILDSTYLES.

Then in your derived CMDIChildWnd classes, just specify a style when
you call CMDIChild::Create.  Note that using this feature you must
specify a style or nothing will appear (i.e. MDIS_ALLCHILDSTYLES is
forces the default style to be 0, which is not really valid).

This code is a snipped copied from the default implementation
of CMDIFrameWnd::CreateClient.


BOOL
CMyMDIFrameWnd::CreateClient(LPCREATESTRUCT /* lpCreateStruct */, 
	CMenu* pWindowMenu)
{
	ASSERT(m_hWnd != NULL);
	
	CLIENTCREATESTRUCT ccs;
	
	ccs.hWindowMenu = pWindowMenu->m_hMenu;
	ccs.idFirstChild = AFX_IDM_FIRST_MDICHILD;
	
	// These styles specify the MDI frame window, the MDIS_ style is
	// for the mdi children windows that will be created
	if ((m_hWndMDIClient = ::CreateWindowEx(0, "mdiclient", NULL, 
		MDIS_ALLCHILDSTYLES | WS_VISIBLE | WS_CHILD | WS_CLIPCHILDREN, 
		0, 0, 0, 0, m_hWnd, NULL, 
		AfxGetInstanceHandle(), (LPSTR)(LPCLIENTCREATESTRUCT)&ccs)) == NULL)
	{
		TRACE("Warning: CMyMDIFrameWnd::CreateClient: failed to create MDICLIENT\n");
		return FALSE;
	}

	return TRUE;
}
-- 
Steven Sinofsky
stevesi@microsoft.com
Disclaimer: I don't speak for Microsoft, BillG does that.
Technical Details
Message-ID: <1992Oct05.010727.2348@microsoft.com>
Path: arc1-ca.pugleaf.net!sparky!uunet!microsoft!wingnut!stevesi
References: <67070@cup.portal.com>

Show Full Headers
Complete Article Headers
Newsgroups: comp.windows.misc,comp.windows.ms,comp.windows.ms.programmer
Path: arc1-ca.pugleaf.net!sparky!uunet!microsoft!wingnut!stevesi
From: stevesi@microsoft.com (Steven Sinofsky)
Subject: Re: MSC 7.0 C++ MFC MDI help me please!!
Message-ID: <1992Oct05.010727.2348@microsoft.com>
Date: 05 Oct 92 01:07:27 GMT
Organization: Microsoft Corporation
References: <67070@cup.portal.com>
Lines: 49