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,
LVL 1
thaneshAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

thaneshAuthor Commented:
Hmmm... the problem is m_progress is null.  Why?
0
thaneshAuthor Commented:
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.
0
jkrCommented:
If you never create the control, the 'm_hWnd' value will not be initialized, so adding the above line will fix that. BTW, why aren't you using a predefined control ID?
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Cloud Class® Course: Microsoft Windows 7 Basic

This introductory course to Windows 7 environment will teach you about working with the Windows operating system. You will learn about basic functions including start menu; the desktop; managing files, folders, and libraries.

thaneshAuthor Commented:
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.  

0
thaneshAuthor Commented:
When I add the progress control through resource editor, and then use Create to create a Progress Control, I have two of them.
0
thaneshAuthor Commented:
I am doing 'Create' to  create the dialog instead of DoModal().  Do you know if this has something to do with it.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
C++

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.