summaryrefslogtreecommitdiff
path: root/Checklist/ExtraPage.cpp
blob: dccc3257b09c9c12660606b0e3d2aac456bd7e8b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
// ExtraPage.cpp : implementation file
//

#include "stdafx.h"
#include "ExtraPage.h"

#include <mystring.h>

/////////////////////////////////////////////////////////////////////////////
// CExtraPage property page


/////////////////////////////////////////////////////////////////////////////
// CExtraPage message handlers

LRESULT CExtraPage::OnSetActive(int idCtrl, LPNMHDR pnmh, BOOL& bHandled) 
{	
	ASSERT(m_pComponent != NULL);
	m_pParentSheet->SetWizardButtons(PSWIZB_BACK | PSWIZB_NEXT);
	return m_pComponent->IsEnabled() ? 0 : -1;
}

LRESULT CExtraPage::OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) 
{
	// Set the Proppage Rectangle to the Place Holder
	::GetWindowRect(GetDlgItem(IDC_PROPHOLDER), &m_rcPropPage);
	ScreenToClient(&m_rcPropPage);

	// Remove Place Holder Control
	::DestroyWindow(GetDlgItem(IDC_PROPHOLDER));

	string sFormat;
	GetDlgItemText(IDC_HEADERTEXT, sFormat.get_buffer(512), 512);
	sFormat.release_buffer();

	string sText;
	sText.format(sFormat, (LPCTSTR)m_pComponent->GetName());

	SetDlgItemText(IDC_HEADERTEXT, sText);
	
	m_pPropPage->Create(*this, m_rcPropPage, true);
	SetWindowLong(GWL_EXSTYLE, GetWindowLong(GWL_EXSTYLE) & WS_EX_CONTROLPARENT);
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}

LRESULT CExtraPage::OnKillActive(int idCtrl, LPNMHDR pnmh, BOOL& bHandled) 
{
	// If we have a PropPage then Save it
	if(m_pPropPage != NULL) 
		m_pPropPage->Apply();
	
	return FALSE;
}

LRESULT CExtraPage::OnHelp(int idCtrl, LPNMHDR pnmh, BOOL& bHandled)
{
	WinHelp(NS_HELP_FILE, HELP_FINDER, 0);
	return 1;
}


LRESULT CExtraPage::OnDestroy(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) 
{
	// If we have a PropPage then Close it
	if(m_pPropPage != NULL) 
		m_pPropPage->Destroy();

	return 0;
}