📄 commoninputdlg.h
字号:
// CommonInputDlg.h : interface of the CCommonInputDlg class
//
/////////////////////////////////////////////////////////////////////////////
#ifndef __CommonInputDlg_h__
#define __CommonInputDlg_h__
class CCommonInputDlg : public CDialogImpl<CCommonInputDlg>
{
public:
enum { IDD = IDD_COMMON_INPUT };
CString m_sTitle;
CString m_sLabel;
CString m_sText;
BEGIN_MSG_MAP(CCommonInputDlg)
MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
COMMAND_ID_HANDLER(IDOK, OnOK)
COMMAND_ID_HANDLER(IDCANCEL, OnCancel)
END_MSG_MAP()
LRESULT OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
{
SetWindowText(m_sTitle);
SetDlgItemText(IDC_LABEL_EDITOR, m_sLabel);
SetDlgItemText(IDC_EDITOR, m_sText);
CenterWindow(GetParent());
return TRUE;
}
LRESULT OnOK(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
{
LPTSTR pText = m_sText.GetBuffer(MAX_PATH);
GetDlgItemText(IDC_EDITOR, pText, MAX_PATH);
m_sText.ReleaseBuffer();
// m_sText.TrimLeft();
// m_sText.TrimRight();
if (m_sText.GetLength() == 0)
{
CString sErrorMsg;
sErrorMsg.LoadString(IDS_INVALID_INPUT);
MessageBox(sErrorMsg, NULL, MB_OK | MB_ICONERROR);
return 0;
}
EndDialog(IDOK);
return 0;
}
LRESULT OnCancel(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
{
EndDialog(IDCANCEL);
return 0;
}
};
#endif //__CommonInputDlg_h__
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -