Condividi tramite


CStatusBarCtrl::GetText

Retrieves the text from the given part of a status bar control.

CString GetText(
   int nPane,
   int* pType = NULL
) const;
int GetText(
   LPCTSTR lpszText,
   int nPane,
   int* pType = NULL 
) const;

Parameters

  • lpszText
    Address of the buffer that receives the text. This parameter is a null-terminated string.

  • nPane
    Zero-based index of the part from which to retrieve text.

  • pType
    Pointer to an integer that receives the type information. The type can be one of these values:

    • 0   The text is drawn with a border to appear lower than the plane of the status bar.

    • SBT_NOBORDERS   The text is drawn without borders.

    • SBT_POPOUT   The text is drawn with a border to appear higher than the plane of the status bar.

    • SBT_OWNERDRAW   If the text has the SBT_OWNERDRAW drawing type, pType receives this message and returns the 32-bit value associated with the text instead of the length and operation type.

Return Value

The length, in characters, of the text or a CString containing the current text.

Example

int nType;
TCHAR* pszPaneOneText;

pszPaneOneText = new TCHAR[ m_wndSBC.GetTextLength(1, &nType) + 1 ];
int nTextLength = m_wndSBC.GetText(pszPaneOneText, 1, &nType);

switch(nType)
{
   case 0:
      // Text is drawn with a border to appear lower than the 
      // plane of the status bar
      break;
   case SBT_NOBORDERS:
      // text is drawn without borders
      break;
   case SBT_OWNERDRAW:
      // Text is drawn by the parent window
      break;
   case SBT_POPOUT:
      // Text is drawn with a border to appear higher than the 
      // plane of the status bar
      break;
}   

delete pszPaneOneText;

Requirements

Header: afxcmn.h

See Also

Reference

CStatusBarCtrl Class

Hierarchy Chart

CStatusBarCtrl::SetText

CStatusBarCtrl::GetTextLength

Other Resources

CStatusBarCtrl Members