!!!!求救::MFC42D.DLL 0XC0000005 Access Violation
dasiu 2005-02-21 03:35:30 我在CPropertyPage的继承类CSetUsersInforAddP2中,通过ID号IDC_COMBO1找到页面的某一个控件,但编译错误:
该函数如下:
BOOL CSetUsersInforAddP2::OnInitDialog()
{
CPropertyPage::OnInitDialog();
HWND* phWnd=NULL;
GetDlgItem(IDC_COMBO1,phWnd);//运行错误!*****
CComboBox combo;
combo.Attach(*phWnd);
combo.Clear();
........
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
通过调试,发现问题的地方在:
void CWnd::GetDlgItem(int nID, HWND* phWnd) const
{
ASSERT(::IsWindow(m_hWnd));
ASSERT(phWnd != NULL);
if (m_pCtrlCont == NULL)
*phWnd = ::GetDlgItem(m_hWnd, nID) ;//错误地方
else
m_pCtrlCont->GetDlgItem(nID, phWnd);
}
请问:这个问题如何解决?在CPAGEPROPERTY页面初始化的时候,如何找到某个控件的句柄等,并进行操作???
谢谢!!!!!!!!