thanesh
asked on
Adding Progress Control gives assertion failure
Hi Experts,
I am trying to add a progress control to a simple dialog. This is what I have done!
1. I added a Progress Control to a dialog.
2. Using Class Wizard, I created a member variable for that control.( m_progress)
3. In the OnInitDialog( ) member function of that dialog class,
m_progress.SetRange(0,100)
When I launch the app, it is giving assertion failure.
This is where it is failing.
_AFXCMN_INLINE void CProgressCtrl::SetRange(sh ort nLower, short nUpper)
{ ASSERT(::IsWindow(m_hWnd)) ; ::SendMessage(m_hWnd, PBM_SETRANGE, 0, MAKELPARAM(nLower, nUpper)); }
Why would I get this error. Actually, calling m_progress.SetStep() also gives assertion failure. My application is a Control Panel Applet, if that has anything to do with it.
Thanks,
I am trying to add a progress control to a simple dialog. This is what I have done!
1. I added a Progress Control to a dialog.
2. Using Class Wizard, I created a member variable for that control.( m_progress)
3. In the OnInitDialog( ) member function of that dialog class,
m_progress.SetRange(0,100)
When I launch the app, it is giving assertion failure.
This is where it is failing.
_AFXCMN_INLINE void CProgressCtrl::SetRange(sh
{ ASSERT(::IsWindow(m_hWnd))
Why would I get this error. Actually, calling m_progress.SetStep() also gives assertion failure. My application is a Control Panel Applet, if that has anything to do with it.
Thanks,
ASKER
If I do:
m_progress.Create(WS_CHILD | WS_VISIBLE, CRect(30, 70, 310, 90), this,0x16);
instead of adding the control through the resource editor it works.
m_progress.Create(WS_CHILD
instead of adding the control through the resource editor it works.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
OK. But, when I insert an EditBox control, for example, from the Resource editor I do not have to do call Create. Then why for this ProgressCtrl I have to do it.
ASKER
When I add the progress control through resource editor, and then use Create to create a Progress Control, I have two of them.
ASKER
I am doing 'Create' to create the dialog instead of DoModal(). Do you know if this has something to do with it.
ASKER