Skip to content

fix DWM taskbar thumbnail live app-preview for modeless WS_DLGFRAME h…#15703

Open
xomx wants to merge 1 commit intonotepad-plus-plus:masterfrom
xomx:fix-DWM-taskbar-thumbnail-live-app-preview-for-some-hidden-dlgs
Open

fix DWM taskbar thumbnail live app-preview for modeless WS_DLGFRAME h…#15703
xomx wants to merge 1 commit intonotepad-plus-plus:masterfrom
xomx:fix-DWM-taskbar-thumbnail-live-app-preview-for-some-hidden-dlgs

Conversation

@xomx
Copy link
Contributor

@xomx xomx commented Oct 13, 2024

Fix #15690

The WinOS Desktop Window Manager taskbar thumbnail live preview has obviously a problem with modeless only hidden dlgs which have the WS_DLGFRAME style - the preview initially shows such dialogs, even if they were already hidden.

Temporarily using the WS_EX_TOOLWINDOW style on such a problematic dlg, right before its hiding and then after the hiding immediately removing that style, does the trick (floating toolbar-wnds are not allowed on the taskbar (or in the ALT-TAB), so DWM probably will not consider them at all for such a preview...).

…idden dialogs

The WinOS Desktop Window Manager taskbar thumbnail live preview has obviously a problem with modeless only hidden dlgs which have the WS_DLGFRAME style - the preview initially shows such dialogs, even if they were already hidden.

Temporarily using the WS_EX_TOOLWINDOW style on such a problematic dlg, right before its hiding and then after the hiding immediately removing that style, does the trick (floating toolbar-wnds are not allowed on the taskbar (or in the ALT-TAB), so DWM probably will not consider them at all for such a preview...).
@donho donho self-assigned this Oct 14, 2024
@donho
Copy link
Member

donho commented Oct 14, 2024

@xomx
It's very tricky...
I'm wondering if we use directly WS_EX_TOOLWINDOW on all dialog, we might save this tricky code.

The WS_EX_TOOLWINDOW have been replaced by WS_EX_DLGMODALFRAME | WS_EX_WINDOWEDGE in this commit:
5e899f2

@ozone10
We need your expertise: I think the reason to replace WS_EX_TOOLWINDOW by WS_EX_DLGMODALFRAME | WS_EX_WINDOWEDGE is for the look of DarkMode. If we restore WS_EX_TOOLWINDOW, will the look change to the annoying way?

@ozone10
Copy link
Contributor

ozone10 commented Oct 15, 2024

@donho
main issue with WS_EX_TOOLWINDOW is that it has no border edge which could make it hard to distinguish between dialog and editor field if user uses same color for them.

Also close button is smaller, same as undocked panels.

IMHO this is Windows bug, IIRC there is similar issue with some QT apps, also not updating live preview.

btw I cannot reproduce it on 2 machines, one with Windows 10 other 11 24H2

@xomx
on which dialogs is WS_DLGFRAME used? Using spy++ I cannot find them.

@xomx
Copy link
Contributor Author

xomx commented Oct 15, 2024

@ozone10

IMHO this is Windows bug

I suppose so - if I restore N++ back and minimize again, the live-preview problem is gone, hidden dlgs are not visible (until I show/hide them again).

I somewhere saw a Java app having exactly this live-preview problem under Windows 10&11 and using successfully such a temporary WS_EX_TOOLWINDOW DWM-workaround, so I tried my luck in N++ and it works.

btw I cannot reproduce it on 2 machines, one with Windows 10 other 11 24H2

I can reproduce on Win10Ent LTSC 2021 and Win11Pro 23H2.

on which dialogs is WS_DLGFRAME used? Using spy++ I cannot find them.

I noticed that even though About-dlg is also based on the StaticDialog class, it does not have that problem with the live-preview when hidden. So I compared all the styles (& ex-styles) from the About and e.g. DebugInfo dlg with and found the necessary condition - WS_DLGFRAME.

npp-DebugInfo-WS_DLGFRAME-DWM-preview-problem

npp-About-no-WS_DLGFRAME-DWM-preview-ok

Another DWM problematic one is Find-dlg.

@ozone10
Copy link
Contributor

ozone10 commented Oct 15, 2024

@xomx
I see, it's part of WS_CAPTION

@donho
Copy link
Member

donho commented Oct 15, 2024

@ozone10
Thank you for the explanation.

IMHO this is Windows bug

@xomx
We all agree that it's Windows' bug.
It's not reasonable to fix it in the applications.
I will wait and see if Microsoft fixes their bug. In the meanwhile, let's keep this PR opened.
If the bug is not fixed in Windows in the future, I will consider to merge the PR.

@donho donho added MS Windows' bug Issue rather of MS Windows suspended labels Oct 15, 2024
@xomx
Copy link
Contributor Author

xomx commented Oct 16, 2024

@donho

I will wait and see if Microsoft fixes their bug

:-)

This is an overly optimistic expectation. Unless a miracle happens, that evidently long standing bug will remain there for good.

@donho
Copy link
Member

donho commented Oct 16, 2024

@xomx

This is an overly optimistic expectation. Unless a miracle happens, that evidently long standing bug will remain there for good.

I see your point, but I still want to give Microsoft a chance to fix their bug. ;)
If the bug persists before Notepad++ release v8.7.2, then the PR will be merged into v8.7.2.

@donho donho added the accepted label Oct 16, 2024
@xomx
Copy link
Contributor Author

xomx commented Oct 17, 2024

@donho

but I still want to give Microsoft a chance to fix their bug. ;)

Ok, I will try not to behave like a spoilsport to your optimism. :-)

Let's pretend the MS does not know about this problem yet. Then a simple POC & video for the report is needed:

PreviewBugPOC.zip

Win10 video (Win11 shows the same, but Win7SP1 in a VM is ok, so it seems to be a Win10+ bug, I do not have Win8 ready for such a test):

PreviewBugPOC4.mp4

Now the hard part - reporting it to them:

If anyone wants to try any of this, feel free to do it (as I will not, good luck).

There is one more "dirty" possibility - somehow pretend/try to pass it off as a security issue and then write a blog post about it and try to make it go viral somehow. It is stupid but it works, nowadays people hear about it and the MS pays attention to its possible negative audience. (How to do it here - I would e.g. write something like: "It is a potential security issue because there could be a deliberately hidden dialog containing sensitive information... blablabla".

Endnote: Do not ever try the MS call support for such a thing - real purpose of this 100% outsourced stuff is to get rid of thousands people annoying the MS every day with often trivial or non-existent problems. It is a filter-wall. For a person with a real technical problem to report, it is a multi-level circular Hell where the only goal is to get the caller to hang up.

@donho
Copy link
Member

donho commented Nov 14, 2024

@xomx

Now the hard part - reporting it to them:

Very true :(

Feedback Hub has been downloaded, and bug was reported (with the POC zip you provided) via Feedback Hub to Microsoft.
And the same bug report was submitted on the both sites:

https://answers.microsoft.com/en-us/windows/forum/windows_11-start-win_taskbar/bug-taskbar-thumbnail-live-previews-show/c36fa139-bc60-48e2-9821-04ec433fc2da

https://techcommunity.microsoft.com/discussions/windows11/bug-windows-11-taskbar-thumbnail-live-previews-show-previously-closed-dialogs/4297001

Thank you very much for the very detail instructions and the POC file.

@donho
Copy link
Member

donho commented Mar 12, 2026

@xomx
Copy link
Contributor Author

xomx commented Mar 12, 2026

The answer from Microsoft:
https://techcommunity.microsoft.com/discussions/windows11/bug-windows-11-taskbar-thumbnail-live-previews-show-previously-closed-dialogs/4297001/replies/4443869

Unfortunately this is not a sln, now I tested on another PC with Win11 25H2 (build 26200.8037), with GPU drivers from late 2025 and the problem is still there. It's a MS bug, not a GPU one.

@ozone10
Copy link
Contributor

ozone10 commented Mar 12, 2026

That bug is also affecting Windows 10. And since Windows 10 is practically EOL and can run on many old PCs, which don't have new GPU driver I don't think that solution is correct.

@donho
Copy link
Member

donho commented Mar 16, 2026

@xomx @ozone10
Thank you. I just replied with the arguments you provided, let's see what MS will say.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG?] Taskbar thumbnail live previews show previously closed dialogs

3 participants