HeaderPane
Main
Share Link
Print

SftDarkMode_Init

Initialize the dark-mode helper. Detects the current "Choose your mode" preference, resolves the undocumented uxtheme.dll dark-mode entry points, hooks comctl32's delay-load import of OpenNcThemeData so dark NC scrollbars work on standard controls, and creates the shared dark background brush.

C

void SftDarkMode_Init(void);

Parameters

None.

Comments

Call at application startup, before any window is created. Typical call sites:

  • Plain Win32: from WinMain, before the first DialogBox / CreateWindow / DialogBoxIndirect call.
  • MFC: from CWinApp::InitInstance, before the first dialog is constructed.

Calling Init again re-reads the Windows setting (replacing any SetActive value) and refreshes the menu theme state; applications that handle WM_SETTINGCHANGE / ImmersiveColorSet themselves call it there, as the samples do. Pair with no explicit shutdown - the helper does not allocate per-process resources that need releasing on exit.

Init is what makes the rest of the SftDarkMode API actually do anything. Without it, SftDarkMode_IsActive returns FALSE, and the ApplyTo* functions and SftDarkMode_HandleDialogMessage leave windows in the light appearance.

Note: the implementation must be compiled into the application by defining SFTDARKMODE_IMPLEMENTATION in exactly one source file before including SftDarkMode.h. Without that define the linker will fail with an unresolved symbol on SftDarkMode_Init.

See Also IsActive | SetActive | ApplyToDialog | HandleDialogMessage


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