Поделиться через


CWnd::GetWindowText

Copies the CWnd caption title (if it has one) into the buffer pointed to by lpszStringBuf or into the destination string rString.

int GetWindowText(
   LPTSTR lpszStringBuf,
   int nMaxCount 
) const;
void GetWindowText(
   CString& rString 
) const;

Параметры

  • lpszStringBuf
    Points to the buffer that is to receive the copied string of the window's title.

  • nMaxCount
    Specifies the maximum number of characters to be copied to the buffer, including the terminating null character. If the string is longer than the number of characters specified in nMaxCount, it is truncated.

  • rString
    A CString object that is to receive the copied string of the window's title.

Возвращаемое значение

Specifies the length, in characters, of the copied string, not including the terminating null character. It is 0 if CWnd has no caption or if the caption is empty.

Заметки

If the CWnd object is a control, the GetWindowText member function copies the text within the control instead of copying the caption.

This member function causes the WM_GETTEXT message to be sent to the CWnd object.

Пример

See the example for CWnd::SetWindowText.

Требования

Header: afxwin.h

См. также

Основные понятия

CWnd Class

CWnd Members

Hierarchy Chart

CWnd::SetWindowText

WM_GETTEXT

CWnd::GetWindowTextLength