Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Collapse the table of content
Expand the table of content


Adjusts the range of the progress bar.

void SetProgressBarRange(
   int nRangeMin,
   int nRangeMax

[in] nRangeMin

The lower bound of the progress bar.

[in] nRangeMax

The upper bound of the progress bar.

The position of the progress bar is relative to nRangeMin and nRangeMax. For example, if nRangeMin is 50 and nRangeMax is 100, a position of 75 is halfway across the progress bar. Use CTaskDialog::SetProgressBarPosition to set the position of the progress bar.

To display the progress bar, the option TDF_SHOW_PROGRESS_BAR must be enabled and TDF_SHOW_MARQUEE_PROGRESS_BAR must not be enabled. This method automatically sets TDF_SHOW_PROGRESS_BAR and clears TDF_SHOW_MARQUEE_PROGRESS_BAR. Use CTaskDialog::SetOptions to manually change the options for this instance of the CTaskDialog Class.

This method throws an exception with the ENSURE (MFC) macro if nRangeMin is not less than nRangeMax. This method also throws an exception if the CTaskDialog is already displayed and has a marquee progress bar.

// TODO: Replace the strings below with the appropriate message,  
// main instruction, and dialog title
CString message("This is an important message to the user.");
CString mainInstruction("Important!\nPlease read!");
CString title("Alert Dialog");

CTaskDialog taskDialog(message, mainInstruction, title, 

// Add a marquee progress bar.


// Remove the marquee bar and replace it with a standard progress bar
taskDialog.SetProgressBarRange(0, 100);


Header: afxtaskdialog.h

© 2015 Microsoft