📄 inputdlg.cpp
字号:
// InputDlg.cpp : implementation file
//
#include "stdafx.h"
#include "Ex7.h"
#include "InputDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CInputDlg dialog
CInputDlg::CInputDlg(CWnd* pParent /*=NULL*/)
: CDialog(CInputDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CInputDlg)
m_strInput = _T("");
//}}AFX_DATA_INIT
}
void CInputDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CInputDlg)
DDX_Text(pDX, IDC_INPUT, m_strInput);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CInputDlg, CDialog)
//{{AFX_MSG_MAP(CInputDlg)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CInputDlg message handlers
BOOL CInputDlg::OnInitDialog()
{
CDialog::OnInitDialog();
// TODO: Add extra initialization here
SetWindowText(m_strTitle);
GetDlgItem(IDC_INPUT)->SetFocus();
// 由于为控件 IDC_INPUT 设置了输入焦点,因此函数 OnInitDialog 应该返回 FALSE
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
CString CInputDlg::GetInput(LPCTSTR lpszTitle, LPCTSTR lpszPrompt)
{
// 设置标题字符串和提示字符串
m_strTitle=lpszTitle;
m_strPrompt=lpszPrompt;
// 显示输入对话框并返回用户输入的字符串
if (DoModal()==IDOK){
return m_strInput;
}
else{
return CString("");
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -