Reputation: 1680
If I have an MFC dialog with a button control on it, is there a way to get construct the HWND or CWND for that control using the button's ID (e.g IDC_BUTTON_YES)?
Upvotes: 1
Views: 7593
Reputation: 195
Yes, you can use the function GetDlgItem of the MFC dialog!
Here is an example for you:
CWnd* myWnd = this->GetDlgItem(IDC_LIST1);
// as CListBox
CListBox* myListBox = (CListBox*)this->GetDlgItem(IDC_LIST1);
Upvotes: 4