📄 mypropertysheet.cpp
字号:
// MyPropertySheet.cpp : implementation file
//
#include "stdafx.h"
#include "DgbTool.h"
#include "MyPropertySheet.h"
//#include "Update.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
class CAboutDlg : public CDialog
{
public:
CAboutDlg();
// Dialog Data
//{{AFX_DATA(CAboutDlg)
enum { IDD = IDD_ABOUTBOX };
//}}AFX_DATA
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CAboutDlg)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
//{{AFX_MSG(CAboutDlg)
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
{
//{{AFX_DATA_INIT(CAboutDlg)
//}}AFX_DATA_INIT
}
void CAboutDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CAboutDlg)
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
//{{AFX_MSG_MAP(CAboutDlg)
// No message handlers
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CMyPropertySheet
IMPLEMENT_DYNAMIC(CMyPropertySheet, CPropertySheet)
CMyPropertySheet::CMyPropertySheet(UINT nIDCaption, CWnd* pParentWnd, UINT iSelectPage)
:CPropertySheet(nIDCaption, pParentWnd, iSelectPage)
{
}
CMyPropertySheet::CMyPropertySheet(LPCTSTR pszCaption, CWnd* pParentWnd, UINT iSelectPage)
:CPropertySheet(pszCaption, pParentWnd, iSelectPage)
{
}
CMyPropertySheet::~CMyPropertySheet()
{
}
BEGIN_MESSAGE_MAP(CMyPropertySheet, CPropertySheet)
//{{AFX_MSG_MAP(CMyPropertySheet)
ON_WM_SYSCOMMAND()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CMyPropertySheet message handlers
void CMyPropertySheet::FindApplyButton(BOOL bVisible)
{
CWnd *pWnd;
// 0x3021 Apply button's ID (but I can't find where it was defined)
pWnd = GetDescendantWindow(0x3021);
if (pWnd) {
pWnd->EnableWindow(bVisible);
//pWnd->ShowWindow(SW_HIDE);
}
}
BOOL CMyPropertySheet::OnChildNotify(UINT message, WPARAM wParam, LPARAM lParam, LRESULT* pLResult)
{
// TODO: Add your specialized code here and/or call the base class
return CPropertySheet::OnChildNotify(message, wParam, lParam, pLResult);
}
BOOL CMyPropertySheet::OnCmdMsg(UINT nID, int nCode, void* pExtra, AFX_CMDHANDLERINFO* pHandlerInfo)
{
// TODO: Add your specialized code here and/or call the base class
if (nID == IDOK) {
// look to see if the user click OK button or not
CPropertyPage *pPage;
CWnd *pWnd;
CString cs;
// note that it is not a good idea to compare window text, but it is a cheap and easy to do it
pPage = GetActivePage();
if (pPage) {
pWnd = pPage->GetFocus();
pWnd->GetWindowText(cs);
if (cs != "OK") {
return TRUE;
}
else {
CDgbToolApp *pApp;
pApp = (CDgbToolApp *)AfxGetApp();
/*
if (pApp->m_bUpdateReg || pApp->m_bUpdateINI) {
CUpdate dlg;
dlg.DoModal();
pApp->m_bUpdated = TRUE;
}
*/
}
}
}
return CPropertySheet::OnCmdMsg(nID, nCode, pExtra, pHandlerInfo);
}
BOOL CMyPropertySheet::OnInitDialog()
{
BOOL bResult = CPropertySheet::OnInitDialog();
// TODO: Add your specialized code here
CMenu* pSysMenu = GetSystemMenu(FALSE);
if (pSysMenu != NULL)
{
CDgbToolApp *pApp;
pApp = (CDgbToolApp *)AfxGetApp();
CString strAboutMenu;
strAboutMenu.LoadString(IDS_ABOUTBOX);
if (!strAboutMenu.IsEmpty())
{
pSysMenu->AppendMenu(MF_SEPARATOR);
pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
}
}
return bResult;
}
void CMyPropertySheet::OnSysCommand(UINT nID, LPARAM lParam)
{
// TODO: Add your message handler code here and/or call default
if ((nID & 0xFFF0) == IDM_ABOUTBOX)
{
CAboutDlg dlgAbout;
dlgAbout.DoModal();
}
else
{
CPropertySheet::OnSysCommand(nID, lParam);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -