Programming with Command Button Controls

Command buttons do not have values, so you should not use SetCtrlVal or GetCtrlVal.

Use SetCtrlAttribute and GetCtrlAttribute with the ATTR_LABEL_TEXT attribute to set and get the string displayed on the button.

Use GetCtrlAttribute with the ATTR_LABEL_TEXT_LENGTH attribute to determine the size of the buffer needed to get the button label. Keep in mind that GetCtrlAttribute appends a NULL byte to the end of the text string, so you must make the buffer 1 byte larger than the value obtained using ATTR_LABEL_TEXT_LENGTH.