Link to home
Start Free TrialLog in
Avatar of thanesh
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(short 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,
Avatar of thanesh
thanesh

ASKER

Hmmm... the problem is m_progress is null.  Why?
Avatar of thanesh

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.
ASKER CERTIFIED SOLUTION
Avatar of jkr
jkr
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of thanesh

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.  

Avatar of thanesh

ASKER

When I add the progress control through resource editor, and then use Create to create a Progress Control, I have two of them.
Avatar of thanesh

ASKER

I am doing 'Create' to  create the dialog instead of DoModal().  Do you know if this has something to do with it.