CStatusBarCtrl::GetIcon

Retrieves the icon for a part (also known as a pane) in the current status bar control.

HICON GetIcon(
            int iPart
) const;

Parameters

Parameter

Description

[in] iPart

The zero-based index of the part that contains the icon to be retrieved. If this parameter is -1, the status bar is assumed to be a simple mode status bar.

Return Value

The handle to the icon if the method successful; otherwise, NULL.

Remarks

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

A status bar control consists of a row of text output panes, which are also known as parts. For more information about the status bar, see Status Bar Implementation in MFC and Setting the Mode of a CStatusBarCtrl Object.

Requirements

Header: afxcmn.h

Example

The following code example defines a variable, m_statusBar, that is used to access the current status bar control. This variable is used in the next example.

public:
    CStatusBarCtrl m_statusBar;

The following code example copies an icon to two panes of the current status bar control. In an earlier section of the code example we created a status bar control with three panes and then added an icon to the first pane. This example retrieves the icon from the first pane and then adds it to the second and third pane.

 // Get the icon from pane 1 and set it in panes 2 and 3.
    HICON hIcon = m_statusBar.GetIcon(0);
    m_statusBar.SetIcon( 1, hIcon );
    m_statusBar.SetIcon( 2, hIcon );

See Also

Concepts

CStatusBarCtrl Class

CStatusBarCtrl Members

Hierarchy Chart

Using CStatusBarCtrl

SB_GETICON

CStatusBarCtrl::SetParts