HeaderPane
Main
Hide
Share Link
Print

HighContrastMode

Defines whether a control honors the Windows High Contrast accessibility setting.

C

int WINAPI SftDate_GetHighContrastMode(HWND hwndCtl);
BOOL WINAPI SftDate_SetHighContrastMode(HWND hwndCtl, int mode);
BOOL WINAPI SftDate_IsHighContrastActive(HWND hwndCtl);

C++

int CSftDate::GetHighContrastMode() const;
int CSftCalendar::GetHighContrastMode() const;
BOOL CSftDate::SetHighContrastMode(int mode);
BOOL CSftCalendar::SetHighContrastMode(int mode);
BOOL CSftDate::IsHighContrastActive() const;
BOOL CSftCalendar::IsHighContrastActive() const;

Parameters

hwndCtl

The window handle of the date field control (SftDate) or the month calendar control (SftCalendar).

mode

Defines the high contrast setting. mode can be one of the following values:

SFTDATE_HIGHCONTRAST_OFFThe Windows high contrast setting is ignored. This is the default.
SFTDATE_HIGHCONTRAST_ONThe control always uses the system colors.
SFTDATE_HIGHCONTRAST_AUTOThe control follows the Windows high contrast setting and switches automatically when the user turns a contrast theme on or off.

Returns

GetHighContrastMode returns the high contrast setting, one of the values listed above.

SetHighContrastMode returns TRUE if mode is valid, otherwise FALSE.

IsHighContrastActive returns TRUE if high contrast mode is currently in effect, otherwise FALSE.

Comments

The GetHighContrastMode, SetHighContrastMode and IsHighContrastActive functions define and retrieve a control's high contrast setting.

While high contrast mode is active, the control ignores the colors defined by the application (SetColor, special dates, NM_SFTDATE_DAYFORMATTING) and dark mode, and uses the system colors of the contrast theme. Themes are not used.

When mode is SFTDATE_HIGHCONTRAST_AUTO, the control follows the Windows setting on its own (through the WM_THEMECHANGED message Windows sends to every window) and sends the NM_SFTDATE_HIGHCONTRAST_CHANGED notification when the state changes. See High Contrast.

Examples

C View entire sample code

    case IDC_DARKMODE:
        for (i = 0; i < CONTROLS; ++i) {
            SftDate_SetDarkMode(c[i], sel);
            SetColorScheme(c[i], IsDlgButtonChecked(hwndDlg, IDC_COLORS) == BST_CHECKED);
        }
        break;
    case IDC_HIGHCONTRAST:
        for (i = 0; i < CONTROLS; ++i)
            SftDate_SetHighContrastMode(c[i], sel);
        break;
    case IDC_BUTTONS:
        for (i = 0; i < FIELDS; ++i)
            SftDate_SetButtons(c[i], sel);
        break;
    case IDC_BORDER:
        for (i = 0; i < FIELDS; ++i)

C++ View entire sample code

    case IDC_DARKMODE:
        for (int i = 0; i < CONTROLS; ++i) {
            Control(i).SetDarkMode(sel);
            SetColorScheme(Control(i), IsDlgButtonChecked(IDC_COLORS) == BST_CHECKED);
        }
        break;
    case IDC_HIGHCONTRAST:
        for (int i = 0; i < CONTROLS; ++i)
            Control(i).SetHighContrastMode(sel);
        break;
    case IDC_BUTTONS:
        for (int i = 0; i < FIELDS; ++i)
            m_Fields[i].SetButtons(sel);
        break;
    case IDC_BORDER:
        for (int i = 0; i < FIELDS; ++i)

See Also C/C++ API | Categories | Notifications


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