@@ -147,13 +147,12 @@ Because `TaskDialogStyle` always returns light-mode colours, every text element
147147paints black-on-dark even when the panel backgrounds are correctly dark.
148148
149149
150- ### Windows 11 (build 22000+)
150+ ### Windows 11
151151
152- ` DarkMode_TaskDialog ` ** does** exist — it covers all panel backgrounds and the
153- expando glyph. ` AllowForTaskDialog ` walks the ` DirectUIHWND ` child tree, calls
154- ` SetWindowTheme(pane, L"DarkMode_TaskDialog", nullptr) ` on each structural
155- pane, then broadcasts ` WM_THEMECHANGED ` . comctl32 repaints the backgrounds via
156- ` dtb(DarkMode_TaskDialog, part, state) ` natively. Text is then owner-drawn to
152+ 1- ` DarkMode_TaskDialog ` ** does** exist — it covers all panel backgrounds and the
153+ expando glyph. ` AllowForTaskDialog ` walks the ` DirectUIHWND ` child tree by its ` AutomationId ` , calls
154+ ` SetWindowTheme(pane, L"DarkMode_TaskDialog", nullptr) `
155+ 2- Text is then owner-drawn to
157156fix the ` TaskDialogStyle ` colour bug described above.
158157
159158### Windows 10 (build 17763–19045)
@@ -162,15 +161,7 @@ fix the `TaskDialogStyle` colour bug described above.
162161
1631621 . Uses ** UI Automation** to walk the ` DirectUIHWND ` child tree, identifying
164163 each element by its ` AutomationId ` (the UIFILE atom names).
165- 2 . Subclasses each pane with ` WM_ERASEBKGND ` / ` WM_CTLCOLORDLG ` /
166- ` WM_CTLCOLORSTATIC ` handlers that return a dark brush with the correct
167- ` SetTextColor ` per element type.
168- 3 . Owner-draws all text elements with ` DrawThemeTextEx ` + ` DTT_TEXTCOLOR `
169- (background filled first since there is no native dark panel paint).
170- 4 . Owner-draws the expando glyph via ` DrawThemeBackground(TaskDialog, 13, state) `
171- reading the current expand/collapse state from window properties
172- (` "IsExpanded" ` , ` "IsChecked" ` ) seeded by ` TDN_EXPANDO_BUTTON_CLICKED ` /
173- ` TDN_VERIFICATION_CLICKED ` .
164+ 2 . Owner-draws all elements.
174165
175166| Element | Windows 10 | Windows 11 |
176167| ---| ---| ---|
@@ -260,12 +251,6 @@ Use `TaskDialogIndirect()` with a `TASKDIALOGCONFIG`.
260251Yes — call ` DarkMode::AllowForTaskDialog(hwnd, pNewConfig) ` from ` TDN_NAVIGATED ` .
261252The included ` main.cpp ` demonstrates page navigation to an Arabic RTL page.
262253
263- ** Why does my text still appear black on Windows 11?**
264- Because ` DarkMode_TaskDialogStyle ` does not exist — see the UIFILE bug section
265- above. All text must be owner-drawn with ` DTT_TEXTCOLOR ` . If you call only
266- ` SetWindowTheme ` without the text owner-draw path you will get dark panel
267- backgrounds but black text.
268-
269254** I see a white flash when the dialog first opens.**
270255Ensure ` DarkMode::AllowForTaskDialog ` is called from ` TDN_CREATED ` , not
271256` TDN_DIALOG_CONSTRUCTED ` . ` TDN_CREATED ` fires after the window is fully
@@ -274,25 +259,8 @@ initialised.
274259** Can I use this from MFC?**
275260Yes — no MFC dependency. Override ` DoMessageBox ` and call
276261` TaskDialogIndirect ` directly. ` DarkMode::Init() ` can go in ` InitInstance ` .
277-
278- ** What about pre-Windows 10?**
279- ` DarkMode::Init() ` reads OS state at startup. All calls are silent no-ops
280- on pre-Win10 systems.
281-
282262---
283263
284- ## Building
285-
286- ``` cmd
287- git clone https://github.com/YourUsername/DarkTaskDialog-NoDetours.git
288- cd DarkTaskDialog-NoDetours
289- msbuild DarkTaskDialog-NoDetours.sln /p:Configuration=Release /p:Platform=x64
290- ```
291-
292- Links only against: ` uxtheme.lib ` ` dwmapi.lib ` ` comctl32.lib ` ` shell32.lib `
293- ` uiautomationcore.lib ` ` msimg32.lib ` — all part of the Windows SDK.
294-
295- ---
296264
297265## Related
298266
0 commit comments