HeaderPane
Main
Hide
Share Link
Print

SetControlInfo

Apply a SFTBUTTON_CONTROL structure to the button, configuring images, colors, text, border, theme and behavior in a single call.

C

BOOL SftButton_SetControlInfo(HWND hwndCtl, LPSFTBUTTON_CONTROL lpCtl);

C++

BOOL CSftButton::SetControlInfo(LPSFTBUTTON_CONTROL lpCtl);

Parameters

hwndCtl

The window handle of the button control.

lpCtl

Pointer to a populated SFTBUTTON_CONTROL structure. cbSize must be set to sizeof(SFTBUTTON_CONTROL).

Return Value

TRUE on success. FALSE if cbSize is wrong or a field is out of range. In that case SetControlInfo stores the SFTBUTTON_ERR code of the first rejected field in the errorValue field of the structure passed in, and no field is applied.

Comments

SetControlInfo is the primary way to configure a button. It applies every field of the structure, so start from GetControlInfo, modify the fields you want to change, then call SetControlInfo. A zeroed structure is not a set of defaults: a color of 0 is black (only SFTBUTTON_NOCOLOR selects the system color), and many defaults are nonzero (border style, themes, focus, border, fill orientation, high contrast, image and pixel scaling).

After SetControlInfo, the control invalidates and redraws itself automatically.

Examples

C

        SftDarkMode_ApplyToDialog(hwndDlg);

        // Configure SftButton control 1
        {
            SFTBUTTON_CONTROL Ctl;
            Ctl.cbSize = sizeof(SFTBUTTON_CONTROL);
            SftButton_GetControlInfo(hwndButton1, &Ctl);
            Ctl.nDarkMode = SFTBUTTON_DARKMODE_AUTO;/* automatic dark mode support */
            SftButton_SetControlInfo(hwndButton1, &Ctl);
        }

        // Configure SftButton control 2
        {
            SFTBUTTON_CONTROL Ctl;
            Ctl.cbSize = sizeof(SFTBUTTON_CONTROL);
            SftButton_GetControlInfo(hwndButton2, &Ctl);

See Also GetControlInfo | SFTBUTTON_CONTROL


Last Updated 10/11/2026 - (email)
© 2026 Softel vdm, Inc.