Pure WinAPI, language is not critical.

The situation is this: I make a window, it is NOT the topmost, and it should remain on the screen when you press Win + M and Win + D. Now I check on Win7, but it should work for anyone. Win + M seems to have won, but with the second ... I can’t understand how Win + D works in general - the window doesn’t receive messages that I logically expected when minimized / moved. And if somehow it turns out to notice that they turned off - it does not go out to prohibit folding. There is a standard program that has the desired behavior, but Spy ++ cannot catch anything in it at all, even under the admin (I saw this the first time).

The problem is that when you click Win + D, the windows disappear (collapse). And should not. Has anyone encountered a question?

PS Maybe you should use some new Shell or DWM shell interfaces, but I won’t find any. :(

  • I'm new here, did not know about the tag "kbd", thanks for the edit! - UI-Maker

1 answer 1

It is necessary to change the parent window so that it belongs to the Desktop.
You may also need to first disable its display on the taskbar.

SetWindowLongPtr Me.hWnd, GWLP_HWNDPARENT, &H800F0 

Where &H800F0 is the handle of the desktop.

I pay attention that option

 SetParent Me.hWnd, &H800F0 

not suitable because it makes the window a part of the desktop, and any (even inactive) windows will be displayed on top of it.

PS: I checked on VB6, I had to set ShowInTaskbar = False in the form designer, otherwise the window is minimized. Hendl of the desktop learned using Spy ++.

  • Most top-level windows have neither "parents" nor "owners". Including the foreign window that can not collapse on Win + D. - UI-Maker
  • @ UI-Maker, created a form on VB6. GetWindowLongPtr(Me.hWnd, GWLP_HWNDPARENT) returns not 0. However, trying to set 0 to the desired effect does not. There is a suspicion that it is necessary to find a specific window and tie it to it, but I do not remember. I read somewhere exactly about something like that. Hmm .. And if to the taskbar? - Qwertiy ♦
  • @ UI-Maker, the answer is updated. It was necessary to do exactly the opposite action that I remembered initially ... - Qwertiy ♦
  • Thank you, interesting information! Some bugs, but maybe you can finish it. Although it looks like a hack. : 3 Only you need to take not a constant, but approximately: GetWindow (FindWindow ("Progman", NULL), GW_CHILD) And then I don't have the & H800F0. >> "GetWindowLongPtr does not return 0" << Most of the ready-made API wrapper libraries make an invisible "program" window, and all forms are created for it as children. Programs on the VCL and MFC do it, apparently on VB too. But by default most windows have zero. I try how it will turn out with this decision, but if someone has other ideas - write. - UI-Maker
  • ... damn, what line breaks don't work on? Everything in one line did ...: C - UI-Maker