ListBox的ID是IDC_LIST1它关联了一个Control的变量m_list
BOOL CWenwenDlg::PreTranslateMessage(MSG* pMsg)
{
if(pMsg->message == WM_RBUTTONDOWN)
{
if(pMsg->hwnd == GetDlgItem(IDC_LIST1)->m_hWnd)
{
m_list.AddString("这是通过右键添加的")
}
}
return CDialog::PreTranslateMessage(pMsg)
}
DDX_Control当然是加在DoDataExchange里面。不过这个强烈不建议手工添加(尤其是初学者),其中有不少的关联关系,建议通过ClassWizard向导等编辑器提供的方式添加。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)