Why is this dont work? I get some assertion error. If I put these 4 lines
into some CDialog member, as OnOk, it will work.
I also tested to set a CProgressCtrl in class CTestDlg, and try it that way,
but I get the same error. My main window is a CWindow. This CDialog appears if I make a menu choise.
---------------
In release mode, line 1 is no problem, but line 2 is failes.
In debug mode, it failes on line 1. I followed the debugger: file Winocc.cpp/ CWnd * CWnd::GetDlgItem(int ...)
ASSERT(::isWindow(m_hWnd)); --> Afxasert.cpp / BOOL bResult=_CrtDbgReport ... I am still helpless.
I use VC++ 5.0 I also tested to use the //{{AFX_DATA(CTestDLG)methode to get in contact with the dialog, but
with the same result. I want to use the progress bar for its purpose: to be able to set StepIt() calls in different places in
a procedure. As I said, if this procedure is a member of CDialog, it works. But people usually want to put StepIt() in
their own procedures, and that is not working for me.

"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.

You need to make sure that the dialog has been created before using that code. You cannot do anything to something that doesn't exist yet. So you have to wait until OnInitDialog has been called before using your code. For example, you can use