Click here to Skip to main content
15,892,674 members
Articles / Desktop Programming / MFC

CPushPinFrame v1.11

Rate me:
Please Sign up or sign in to vote.
4.20/5 (3 votes)
3 Mar 2000 79.4K   889   22  
A Freeware MFC PushPin property page dialog class.
#include "stdafx.h"
#include "resource.h"
#include "Props.h"
#include "app.h"
#include "dlg.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

CDemoAppDlg::CDemoAppDlg(CWnd* pParent /*=NULL*/)
	: CDialog(CDemoAppDlg::IDD, pParent)
{
	//{{AFX_DATA_INIT(CDemoAppDlg)
	//}}AFX_DATA_INIT
	m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
  m_pPropFrame = NULL;
}

void CDemoAppDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CDemoAppDlg)
	//}}AFX_DATA_MAP
}

BEGIN_MESSAGE_MAP(CDemoAppDlg, CDialog)
	//{{AFX_MSG_MAP(CDemoAppDlg)
	ON_BN_CLICKED(IDC_BUTTON1, OnButton1)
	ON_BN_CLICKED(IDC_BUTTON2, OnButton2)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

BOOL CDemoAppDlg::OnInitDialog()
{
	CDialog::OnInitDialog();

	SetIcon(m_hIcon, TRUE);
	SetIcon(m_hIcon, FALSE);
	
	return TRUE;
}

void CDemoAppDlg::OnButton1()
{
	if (m_pPropFrame == NULL)
	{
		m_pPropFrame = new CPushPinFrame;
		ASSERT(m_pPropFrame);
		m_pPropFrame->SetAttachedPropertySheet(RUNTIME_CLASS(CPropertySheet1));

		CRect rect(0, 0, 0, 0);
		CString strTitle;
		VERIFY(strTitle.LoadString(IDS_PROPSHT_CAPTION));
		if (!m_pPropFrame->Create(NULL, strTitle,	WS_POPUP | WS_CAPTION | WS_SYSMENU, rect, this))
		{
			TRACE(_T("Failed to create the push pin frame\n"));
			delete m_pPropFrame;
			m_pPropFrame = NULL;
			return;
		}
		m_pPropFrame->CenterWindow();

    m_pPropFrame->ShowWindow(SW_SHOW);
	}
  else
  {
    if (!m_pPropFrame->IsWindowVisible())
      m_pPropFrame->ShowWindow(SW_SHOW);
  }
}

void CDemoAppDlg::OnButton2() 
{
	CRect prevRect;
	if (m_pPropFrame != NULL)
		m_pPropFrame->ChangeAttachedPropertySheet(RUNTIME_CLASS(CPropertySheet2));
	else
		AfxMessageBox(_T("Click on Load properties sheet button first."));
}

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.

License

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


Written By
United States United States
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions