Debug Assertion Failed!

I get that message when clicking a specific button.
I saw somebody else had posted the same question earlier.
I ran debugger to trace the problem and it goes in the winocc.cpp file and specifically:

CWnd* CWnd::GetDlgItem(int nID) const
{
ASSERT(::IsWindow(m_hWnd)); // THIS LINE POINTED

if (m_pCtrlCont == NULL)
return CWnd::FromHandle(::GetDlgItem(m_hWnd, nID));
else
return m_pCtrlCont->GetDlgItem(nID);
}

Comments

  • You are probably calling GetDlgItem or something similar in a dialog prior to OnInitDialog.

    What's the parent code?

    : I get that message when clicking a specific button.
    : I saw somebody else had posted the same question earlier.
    : I ran debugger to trace the problem and it goes in the winocc.cpp file and specifically:
    :
    : CWnd* CWnd::GetDlgItem(int nID) const
    : {
    : ASSERT(::IsWindow(m_hWnd)); // THIS LINE POINTED
    :
    : if (m_pCtrlCont == NULL)
    : return CWnd::FromHandle(::GetDlgItem(m_hWnd, nID));
    : else
    : return m_pCtrlCont->GetDlgItem(nID);
    : }
    :

  • [b][red]This message was edited by the menelaos at 2002-5-1 11:40:49[/red][/b][hr]
    I figured out where the problem is, but i dont know how to fix it.
    The main class is CAlarmDlg and the derived one from which the code is running is System.
    I have included the following line for a radio button that i am using.

    CButton* pPower = (CButton*)GetDlgItem(IDC_POWER);
    pPower->SetCheck(1);

    This code is inside the System class and the IDC_POWER is in CAlarmDlg.

    All your help is greatly appreciated.
    Thanx.



Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories