title: TopMost window going behind non-TopMost fullscreen window sometimes
body: <p>I have a "control toolbar" app that needs to float on top of everything else on the primary screen of a dual monitor system. It positions itself at the top of the primary screen and sets TopMost=true.</p>
  
  <p>This control toolbar can be used to launch two other processes which run fullscreen but NOT TopMost, one on each monitor on the dual monitor system. These windows are setup to run fullscreen by setting BorderStyle to None and setting the bounds of the window to fit exactly into the screen dimensions. The fullscreen windows have no problem covering the taskbar, and I can focus and interact with the fullscreen window on the primary monitor all day and the toolbar stays on top.</p>
  
  <p>All is not peachy in the kingdom of software however - certain actions make the TopMost toolbar pop under the non-TopMost fullscreen windows. One of those actions is giving focus to the fullscreen app on the secondary monitor, then giving focus back to the fullscreen app on the primary monitor. This is the easiest situation to reproduce as it happens every time I follow this sequence. I have a hard time reproducing other scenarios reliably, but if I hit the windows key to pull up the start menu and start browsing in Internet Explorer, <em>sometimes</em> when I am done browsing and close IE and give focus back to the primary monitor fullscreen app it pops over the TopMost window.</p>
  
  <p>Any idea how to keep the TopMost window on top, and not allow it to pop under a non-TopMost fullscreen window? I wouldn't mind doing something like polling WindowFromPoint once a second to see if the toolbar is still on top and if not then pop it back over somehow, but I don't want to take focus away from the fullscreen app if that's what the user is using, so Activate() isn't a particularly good solution.</p>
  
  <p>I don't think this really matters, but the toolbar is a WPF window and the fullscreen apps are WinForms.</p>
  
  <p>UPDATE:</p>
  
  <p>The easiest way to test this is to press F11 to go fullscreen in two browser windows on each monitor to simulate the full screen apps and then have a TopMost window floating anywhere. Click between the two fullscreen windows and you will see the TopMost window pop under them. I opened IE on one monitor and Chrome on another since IE doesn't let me do two fullscreen windows.</p>
  
  <p>I implemented the Activate() hack for now, but it's a rather ugly solution because it activates the toolbar app which unfocuses the fullscreen app, which in turn makes the taskbar pop over the fullscreen app. Kind of hacky when all you want to do is switch which fullscreen app has focus.</p>