Microsoft Foundation Class Library (MFC) - MFC Windows Control - MFC Progress Control - Microsoft Foundation Class Library (MFC)

What is a progress control in MFC?

An application which can be used to indicate the progress of a lengthy operation is known as a progress bar. It is in a rectangular shape that if filled from left to right, and while the operation is in progress, the system highlights colour, and is represented by CProgressCtrl class.

The list of methods of CProgressCtrl class are as follows:

Sr.No.
Name & Description
1
Create
Creates a progress bar control and attaches it to a CProgressCtrl object.
2
CreateEx
Creates a progress control with the specified Windows extended styles and attaches it to a CProgressCtrl object.
3
GetBarColor
Gets the color of the progress indicator bar for the current progress bar control.
4
GetBkColor
Gets the background color of the current progress bar.
5
GetPos
Gets the current position of the progress bar.
6
GetRange
Gets the lower and upper limits of the range of the progress bar control.
7
GetState
Gets the state of the current progress bar control.
8
GetStep
Retrieves the step increment for the progress bar of the current progress bar control.
9
OffsetPos
Advances the current position of a progress bar control by a specified increment and redraws the bar to reflect the new position.
10
SetBarColor
Sets the color of the progress indicator bar in the current progress bar control.
11
SetBkColor
Sets the background color for the progress bar.
12
SetMarquee
Turns marquee mode on or off for the current progress bar control.
13
SetPos
Sets the current position for a progress bar control and redraws the bar to reflect the new position.
14
SetRange
Sets the minimum and maximum ranges for a progress bar control and redraws the bar to reflect the new ranges.
15
SetState
Sets the state of the current progress bar control.
16
SetStep
Specifies the step increment for a progress bar control.
17
StepIt
Advances the current position for a progress bar control by the step increment (see SetStep) and redraws the bar to reflect the new position.

For instance, a new MFC application is created by the following steps:

Step 1 − Change the ID of the Text control to and remove the caption.

Step 2 − Drag Progress Control from the Toolbox.

Step 3 − Add value variable for Static Text control.

Progress Control

Step 4 − Add control variable for the Progress control.

Progress Control

Step 5 − The implementation in OnInitDialog() is as follows:

Step 6 − When the above code is compiled and executed, the following output appears:

Progress Control


All rights reserved © 2020 Wisdom IT Services India Pvt. Ltd DMCA.com Protection Status

Microsoft Foundation Class Library (MFC) Topics