Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如果我有一个带有按钮控件的 MFC 对话框,有没有办法使用按钮的 ID(例如 IDC_BUTTON_YES)为该控件构造 HWND 或 CWND?
是的,您可以使用 MFC 对话框的 GetDlgItem 函数!
这是一个例子:
CWnd* myWnd = this->GetDlgItem(IDC_LIST1); // as CListBox CListBox* myListBox = (CListBox*)this->GetDlgItem(IDC_LIST1);