Share via


CProgressCtrl::GetState

Gets the state of the current progress bar control.

int GetState() const;

Return Value

The state of the current progress bar control, which is one of the following values:

Value

State

PBST_NORMAL

In progress

PBST_ERROR

Error

PBST_PAUSED

Paused

Remarks

This method sends the PBM_GETSTATE message, which is described in theWindows 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 retrieves the state of the current progress bar control.

// Display the current state of the progress control.
    CString str = _T("The progress control state is ");
    int progState = m_progressCtrl.GetState();
    if (progState == PBST_NORMAL)
        str += _T("NORMAL");
    else if (progState == PBST_PAUSED)
        str += _T("PAUSED");
    else if (progState == PBST_ERROR)
        str += _T("ERROR");
    else 
        str += _T("unknown");
    AfxMessageBox(str, MB_ICONEXCLAMATION);

See Also

Reference

CProgressCtrl Class

Hierarchy Chart

Using CProgressCtrl

PBM_GETSTATE

CProgressCtrl::SetState