-
I've created a progress bar using the edit control menu on MFC visual C++
I added member variable, m_Progress to that status bar, and labeled it as a control, using the member class: CProgressCtrl
I've been attempting to use the following code to update the bar:
Code:
CProgressCtrl *m_Progress;
m_Progress->SetPos(1, 100);
m_Progress->StepIt();
I don't get any compiler errors but it does not update my progress bar, I guessing based off the other posts that I am simply not updating the window appropriately. Am I way off here?? Does the above code have any merit or am I misunderstanding the samples given?
-
Try setting the step increment with CProgressCtrl::SetStep prior to calling the StepIt member function (see the example I linked to in my previous post).
-
I altered my code for the SetStep like so:
Code:
CProgressCtrl m_Progress;
int nLower = 0, nUpper = 100;
m_Progress.GetRange( nLower, nUpper );
m_Progress.SetStep(nLower);
m_Progress.StepIt();
m_Progress.StepIt();
m_Progress.StepIt();
m_Progress.StepIt();
but still no success, I think I am missing the fundamentals of message handling to windows updates.... Have I missed a step above ??? By the way thanks for the example code earlier, the non-msdn article helped me understand alot more about what I was trying to do. Just wish I could get it to work now....
-
HAPPY DAYS!!! I got this to work for me
Code:
//progress bar initialize
CProgressCtrl *Progress = new CProgressCtrl;
Progress->Create(WS_CHILD | WS_VISIBLE, CRect(10, 10, 250, 35), this,0x16);
Progress->SetRange(1, 100);
Progress->SetPos(38);
Now I just need to learn about position, how to get it placed in the proper demensions of the window, ect... Hey thanks everyone for your help, this is cool stuff.