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

📄 lettersdlg.h

📁 The source code samples for chapter 2, 4, 6, and 8 are contained in the EvenChapters project. Those
💻 H
字号:
// LettersDlg.h

#pragma once

class CLettersDlg : public CDialogImpl<CLettersDlg> {
public:
  // Set the CMessageMap* and the message map id
  CLettersDlg() : m_edit(this, 1) {}

BEGIN_MSG_MAP(CLettersDlg)
  MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
  COMMAND_ID_HANDLER(IDOK, OnCommand)
  COMMAND_ID_HANDLER(IDCANCEL, OnCommand)
ALT_MSG_MAP(1)
  MESSAGE_HANDLER(WM_CHAR, OnEditChar)
END_MSG_MAP()

  enum { IDD = IDD_LETTERS_ONLY };

  LRESULT OnInitDialog(UINT, WPARAM, LPARAM, BOOL&) {
    // Subclass the existing child edit control
    m_edit.SubclassWindow(GetDlgItem(IDC_EDIT));

    return 1; // Let the dialog manager set the initial focus
  }

  LRESULT OnEditChar(UINT, WPARAM wparam, LPARAM, BOOL& bHandled) {
    if( isalpha((TCHAR)wparam) ) bHandled = FALSE;
    else                         MessageBeep(0xFFFFFFFF);
    return 0;
  }

  LRESULT OnCommand(WORD, UINT nID, HWND, BOOL&) {
    EndDialog(nID);
    return 0;
  }

private:
  CContainedWindowT<ATLControls::CEdit> m_edit;
};

⌨️ 快捷键说明

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