1

I've uploaded a VS2010 project at the below location. This test app should be run once you have a full screen application running. As soon as its running, you have 2 seconds to click back on your fullscreen application. It creates 2 modeless dialog boxes using the full screen application (which should be the last window to have focus) as the owner of the dialog boxes. One dialog is displayed, hidden, the second dialog is displayed, hidden and then the first dialog is displayed again in a cycle. What I find is that when the first dialog box is displayed for the second time, the taskbar pops up. I've spent 4 painful days trying to understand whats going on here and I am desperate for some help.

I received some help which suggested that when I call DestroyWindow to hide the dialogs, Windows would put focus "somewhere" - and in my case the taskbar. Previously when I asked this question I wasn't using the full screen application as the Owner of my windows. I would have thought that the focus should go back to the owner window? I have also tried calling SetFocus() and SetForegroundWindow() on the full screen application prior to calling DestroyWindow on my dialog - but the seems to cause the taskbar to appear everytime and I don't want that at all.

Please help!

Sample VS2010 Project

SparkyNZ
  • 6,266
  • 7
  • 39
  • 80
  • Very unclear. If you don't give Windows a good option to pick a window to give the focus to by intentionally destroying the window that has the focus without another one to take its place then it is going to hunt for one. Sure, the taskbar is a candidate. – Hans Passant Sep 06 '11 at 23:35
  • Thanks Hans. How would I go about telling Windows which window should be the next one to have focus? I thought SetFocus and SetForegroundWindow were to service this purpose but they're not working the way I expect? – SparkyNZ Sep 07 '11 at 00:30

0 Answers0