Thread: progress bar newbie

  1. #16
    Registered User
    Join Date
    May 2004
    Posts
    164
    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?

  2. #17
    erstwhile
    Join Date
    Jan 2002
    Posts
    2,227
    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).
    CProgramming FAQ
    Caution: this person may be a carrier of the misinformation virus.

  3. #18
    Registered User
    Join Date
    May 2004
    Posts
    164
    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....

  4. #19
    Registered User
    Join Date
    May 2004
    Posts
    164
    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.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Progress Bar
    By Stabbsy in forum Windows Programming
    Replies: 4
    Last Post: 11-04-2007, 10:30 PM
  2. Updating a progress bar
    By NewGuy100 in forum C++ Programming
    Replies: 2
    Last Post: 03-13-2006, 01:00 PM
  3. beach bar (sims type game)
    By DrKillPatient in forum Game Programming
    Replies: 1
    Last Post: 03-06-2006, 01:32 PM
  4. Is comctl32.lib required for progress bar controls?
    By JasonD in forum Windows Programming
    Replies: 4
    Last Post: 08-28-2004, 03:30 PM
  5. File Through Winsock & Progress on bar
    By (TNT) in forum Windows Programming
    Replies: 4
    Last Post: 12-05-2001, 10:50 PM
Website Security Test