Help: Updating a Progress Bar
Quote:
>I am doing a MFC based executable, and I placed a progress bar using the
>standard control drop in to place it into the dialog box that I am using
>in the project I have created.
>I want to increment the progress bar, but the descriptions in the Help
>Index and everything else that I have seen are really way out there. I
>couldn't pull anything worthwhile from them.
>Could someone give me a really simple example using a standard progress
>bar?
Bring up Class Wizard (Ctrl-W) and select the dialog box class then
the member variables tab. In the control list select the control ID
for the progress bar. Press the Add Variable button and select the
Control type and give the variable a name, say m_MyProgressBar. In
the OnInitDialog() member function for the dialog class set the range
for the progress control to display, so for 0 to 100 (percent based
operation) use: m_MyProgressBar.SetRange(0, 100). Now, in the
function that needs to update the progress bar calculate the progress
to a number between the range limits set for the control in
OnInitDialog() then set the position of the control to the calculated
number: m_MyProgressBar.SetPos(newPosition).
Regards,
David.
--
Spam safe e-mail address (I hope), remove not. both
times it appears to contact me. I reserve the right
to respond only on a newsgroup if I choose.