⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 step1dlg.cpp

📁 讲mfc的书
💻 CPP
字号:
// Step1Dlg.cpp : implementation file
//

#include "stdafx.h"
#include "shiconwz.h"
#include "shiconwzaw.h"


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

////////////////////////
// CStep1Dlg dialog


CStep1Dlg::CStep1Dlg(CWnd* pParent /*=NULL*/)
        : CAppWizStepDlg(CStep1Dlg::IDD)
{
        //{{AFX_DATA_INIT(CStep1Dlg)
        m_extension = _T("");
        m_desc = _T("");
        m_filetype = _T("");
        //}}AFX_DATA_INIT
}


void CStep1Dlg::DoDataExchange(CDataExchange* pDX)
{
        CDialog::DoDataExchange(pDX);
        //{{AFX_DATA_MAP(CStep1Dlg)
        DDX_Text(pDX, IDC_EXTENSION, m_extension);
        DDX_Text(pDX, IDC_DESC, m_desc);
        DDX_Text(pDX, IDC_FILETYPE, m_filetype);
        DDV_MaxChars(pDX, m_filetype, 8);
        //}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CStep1Dlg, CAppWizStepDlg)
        //{{AFX_MSG_MAP(CStep1Dlg)
// NOTE: the ClassWizard will add message map macros here
        //}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////
// CStep1Dlg message handlers


/* Do DDX and update dictionary before page is
   dismissed */
BOOL CStep1Dlg::OnDismiss()
{
if (!UpdateData(TRUE)) return FALSE;  // invalid data
// Do custom validatation
// No empty fields
if (m_extension.IsEmpty()||m_filetype.IsEmpty()||m_desc.IsEmpty())
{
  MessageBox("Please complete all entries");
  return FALSE;
}
// If extension starts with '.' chop it off
// a . anywhere else is an error
if (m_extension.Find('.')!=-1)
{
        if (m_extension.Find('.')==0)
                m_extension=((LPCSTR)m_extension)+1;
        else
        {
            CWnd *ext=GetDlgItem(IDC_EXTENSION);
            MessageBox("Do not include a period in the extension");
            ext->SetFocus();
            return FALSE;
        }

}

// No space or tab in file type
if (m_filetype.Find(' ')!=-1||m_filetype.Find('\t')!=-1)
{
        CWnd *ft=GetDlgItem(IDC_FILETYPE);
        MessageBox("File type can't contain blanks");
        ft->SetFocus();
        return FALSE;
}
// Update
Shiconwzaw.m_Dictionary[_T("EXT")]=m_extension;
Shiconwzaw.m_Dictionary[_T("FILETYPE")]=m_filetype;
Shiconwzaw.m_Dictionary[_T("DESC")]=m_desc;
return TRUE; // allow wizard to proceed
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -