Changing the Button Text

You can change the text in a button (or in any other window) by calling SetWindowText:

SetWindowText (hwnd, lpszString) ;

where hwnd is a handle to the window whose text is being changed and lpszString is a long (or far) pointer to a null-terminated string. For a normal window, this text is the text of the caption bar. For a button control, it's the text displayed with the button.

You can also obtain the current text of a window:

nLength = GetWindowText (hwnd, lpszBuffer, nMaxLength) ;

The nMaxLength parameter specifies the maximum number of characters to copy into the buffer pointed to by lpszBuffer. The function returns the string length copied. You can prepare your program for a particular text length by first calling:

nLength = GetWindowTextLength (hwnd) ;