2

I have a complicated program in C++ (hybrid of old-school Win32 and WTL) which does not respond to any taskbar tile/cascade request (i.e. right click on task bar and select "Cascade Windows" or "Show window side by side"). When I use spy++, I found that none of my window is receiving any window message, while other programs (in this case, Firefox) get a series of WM_GETMINMAXINFO, WM_SIZE, WM_PAINT ...

My frame window is styled as WS_OVERLAPPEDWINDOW. I create several hidden windows before creating the frame window. I have tested on multiple different OS'es and the symptoms are the same. Is there any limitation or prerequisites for Windows shell to send out messages to my frame window?

Peon the Great
  • 1,289
  • 1
  • 10
  • 17
  • Have you removed any menu items (like size) from the system menu? – Tergiver Apr 15 '11 at 17:59
  • No, but we do add menu items to it. – Peon the Great Apr 15 '11 at 22:34
  • For what it's worth, Chrome and Spy++ also appear to be immune from these layout requests. Nobody at Chrome seems to know why either: http://code.google.com/p/chromium/issues/detail?id=900 – BrendanMcK Apr 19 '11 at 09:08
  • Turns out the reason Spy++ doesn't do it is because it's elevated - so explorer can't send it the appropriate messages - any other app run as admin is also immune. Doesn't explain the Chrome case though. – BrendanMcK Apr 19 '11 at 10:01

1 Answers1

2

Windows sends the messages to the window which is represented by the taskbar button.

In your app, and I'm guessing a bit here, it is one of the hidden windows which is represented by the taskbar button. The window manager won't send any of these messages to a hidden window.

You can solve the problem by arranging that the main window is the one represented in the taskbar. You can read all about the gory details of which windows appear in the taskbar in the excellent MSDN topic titled Window Features.

David Heffernan
  • 601,492
  • 42
  • 1,072
  • 1,490
  • The odd part is the I've spied all windows (including hidden window) using spy++ and none of them receive any message from taskbar. BTW, how do I tell which window is represented by the taskbar button? – Peon the Great Apr 15 '11 at 20:03
  • 2
    Chrome suffers from the same problems (not responding correctly to tiling), although I'm not 100% sure why it struggles. The text displayed in the taskbar button is the window text of the window in question (what you set with a call to SetWindowText or a WM_TEXT message). If this text is the same as the caption of your main form then my guess is wrong and I'll delete the answer. If my hunch is right then AeroPeek should not work for your app. – David Heffernan Apr 15 '11 at 20:06
  • Yes, it's my main frame window and the text is the same. On Windows 7, the preview window is shown correctly, Windows+arrow keys works as expected, just the tiling/cascading don't work. Odd enough, my notepad.exe does not tile/cascade on some Windows 7 machines, either. I wish some guru in StackOverflow can answer this. – Peon the Great Apr 15 '11 at 20:28
  • What's the answer to the question asked by Tergiver in the comment? Can you run your app without the hidden windows? – David Heffernan Apr 15 '11 at 20:29
  • For your main window do you pass anything to hWndParent when you call CreateWindowEx? – David Heffernan Apr 15 '11 at 20:35
  • @David: Did not see anything from Tergiver. I can't run without hidden windows. The hWndParent I passed in is NULL. – Peon the Great Apr 15 '11 at 22:02
  • It's in a comment to your question. Tergiver asks: "Have you removed any menu items (like size) from the system menu?" What is the answer? – David Heffernan Apr 15 '11 at 22:04