CProgressCtrl::SetState

Sets the state of the current progress bar control.

int SetState(
    int iState
);

Parameters

Parameter

Description

[in] iState

The state to set the progress bar. Use one of the following values:

Value

State

PBST_NORMAL

In progress

PBST_ERROR

Error

PBST_PAUSED

Paused

Return Value

The previous state of the current progress bar control.

Remarks

This method sends the PBM_SETSTATE message, which is described in the Windows SDK.

Requirements

Header: afxcmn.h

This control is supported in Windows Vista and later.

Additional requirements for this method are described in Build Requirements for Windows Vista Common Controls.

Example

The following code example defines the variable, m_progressCtrl, that is used to programmatically access the progress bar control. This variable is used in the next example.

  // Variable to access the progress control
    CProgressCtrl m_progressCtrl;

The following code example sets the state of the current progress bar control to Paused or In Progress.

// Set the progrees control to normal or paused state. 
void CCProgressCtrl_s1Dlg::OnSetstateNormal()
{
    m_progressCtrl.SetState(PBST_NORMAL);
}

void CCProgressCtrl_s1Dlg::OnSetstatePaused()
{
    m_progressCtrl.SetState(PBST_PAUSED);
}

See Also

Reference

CProgressCtrl Class

Hierarchy Chart

Using CProgressCtrl

PBM_SETSTATE

CProgressCtrl::GetState