int GetWindowText(hWnd,lpString,nMaxCount)
This function copies the given window's caption title (if it has one) into the buffer
pointed to by the lpString parameter. If the hWnd parameter identifies a control, the
GetWindowText function copies the text within the control instead of copying the
caption.
Parameter | Type/Description |
hWnd | HWND Identifies the window or control whose caption or text is to be copied. | |
lpString | LPSTR Points to the buffer that is to receive the copied string. | |
nMaxCount | int Specifies the maximum number of characters to be copied to the buffer. If the string is longer than the number of characters specified in the nMaxCount parameter, it is truncated. |
The return value specifies the length of the copied string. It is zero if the window has no caption or if the caption is empty.
This function causes a WM_GETTEXT message to be sent to the given window or control.