What is probably happening is that the desktop window is covering your window so you think it has been minimized. If you add WS_EX_TOPMOST to the window extended styles then the desktop won't cover it. See What is the difference between Minimize All and Show Desktop?
How to avoid minimize on show desktop or peek desktop from an application.
Hi,
I am trying to create a desktop widget like application which need to be visible on desktop at all times. To hide it from taskbar and alt + tab menu I am using WS_EX_TOOLWINDOW window style.
The problem is the application is minimized when using Peek Desktop function or Win + D shortcut or Show desktop button.
What is the best way to avoid/handle this minimization?
Thanks in advance.
2 answers
Sort by: Most helpful
-
-
RLWA32 46,191 Reputation points
2024-12-12T15:51:20.7333333+00:00 For what its worth I solved the problem by installing a WH_GETMESSAGE hook in the Explorer process. Spy++ (64-bit version) showed that an undocumented message (WM_USER+83) was posted to the Program Manager window available from the GetShellWindow function whenever Show Desktop/Show Open Windows was invoked regardless of the method used to invoke it. The hook procedure watches for this message and, when detected it posts a message back to the test application make its window topmost or not.
For example,
Naturally, this is all implementation dependent and is not guaranteed to work on all Windows versions/builds. I tested on Win10 22H2 with all updates installed.