Click here to Skip to main content
12,998,483 members (128,515 online)
Click here to Skip to main content


51 bookmarked
Posted 12 Oct 2000

Persistent Frames

, 6 Jan 2001
A collection of classes that allows MFC SDI and MDI applications to remember the positions and sizes of their main frame and child frame windows.

#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000

 FILE       : PersistFrameImpl.h

 Author		: Stefan Chekanov (

 Description: Definition of CPersistFrameImpl class which implements persistent 
			  Frame windows (MDI, MDI Child and SDI) common behaviour.

Copyright(c) 1998,1999,2000
by Stefan Chekanov (

This code may be used in compiled form in any way you desire. This
file may be redistributed unmodified by any means PROVIDING it is 
not sold for profit without the authors written consent, and 
providing that this notice and the authors name is included. If 
the source code in this file is used in any commercial application 
then a simple email to the author would be nice.

This file is provided "as is" with no expressed or implied warranty.
The author accepts no liability if it causes any damage.

/* #    Revisions    # */


class CPersistFrameImpl
	CPersistFrameImpl( CFrameWnd* pWnd = NULL, LPCTSTR szHeading = NULL, bool bBarStates = false );
	virtual ~CPersistFrameImpl();

	virtual	void	Load();
	virtual	void	Save();

	UINT				getCmdShow() {
		return	m_nCmdShow;

	LPWINDOWPLACEMENT	getWindowsPlacement() {
		return	&m_wndpl;

	//	Set the window for which this object load/save state info
	void	SetWindow( CFrameWnd* pWnd ) {
		m_pWnd = pWnd;

	//	Set the registry section where the state info to be saved/loaded from
	void	SetProfileHeading( LPCTSTR szHeading ) {
		m_profileHeading = szHeading;

	//	Specify whether positions of control bars should be saved/restored too.
	void	SetManageBarStates( bool bManage ) {
		m_bManageBarStates = bManage;

	CFrameWnd*		m_pWnd;
	UINT			m_nCmdShow;

	CString		m_profileHeading;			//	The assigned Profile Heading
	bool		m_bManageBarStates;			//	True if we should manage bar states too
											//	By default it is false

    static TCHAR	s_profileHeading[];		//	Default profile heading
    static TCHAR	s_profileRect[];
    static TCHAR	s_profileIcon[];
    static TCHAR	s_profileMax[];
	static TCHAR	m_profileBarState[];

#endif	//	__PERSISTWNDIMPL_H__

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.


This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


About the Author

Stefan Chekanov
Software Developer (Senior) Brosix
Bulgaria Bulgaria
Stefan does programming since his early ages more than 20 years ago. Later he began programming at his work and now he is very happy to work his hobby. He owns a Master's degree in Computer Science.

During his professional career, Stefan has worked with many technologies. His programming experience includes C/C++, Java, C#, PHP, JavaScript, MFC, ATL, ASP, ASP.NET, TCP/IP, SQL. He has worked with different operating systems: Windows, Linux, Mac OS X, iOS, Android, Solaris, FreeBSD, NetBSD and QNX.

Currently his professional interests are in building large scale distributed systems that operate over the Internet. This involves building server components as well as developing system level software.

More information about his current work can be found here: - Enterprise Instant Messaging

Stefan is based in Plovdiv, Bulgaria. It is a very nice and peaceful place combined with an enjoyable weather.

Stefan has a wife and 2 children. He likes in his spear time to travel with his family to see new and interesting places.

You may also be interested in...

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.170622.1 | Last Updated 7 Jan 2001
Article Copyright 2000 by Stefan Chekanov
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid