0

I have an application that displays a dialogue box during operation. The issue is that sometimes I'll have multiple applications open and this dialogue box will appear behind those others.

Can I administratively tell Windows to always give certain applications foreground priority? So if/when they pop-up a window, it'll always be on top?

Mike B
  • 2,660
  • 14
  • 41
  • 59
  • 1
    the applications must support this (wndTopMost) and must give you an option. There is no global setting. – magicandre1981 Jul 21 '14 at 04:21
  • @magicandre1981 Thanks for the confirmation. If you'd like to put that in an answer field below, I'll be happy to give you credit and close this question out. – Mike B Jul 21 '14 at 18:54
  • possible duplicate of [Force a window to stay always on top in Windows 7](http://superuser.com/questions/611325/force-a-window-to-stay-always-on-top-in-windows-7), [Is it possible to get the Ubuntu 'Always on top' functionality in Windows?](http://superuser.com/questions/105699/is-it-possible-to-get-the-ubuntu-always-on-top-functionality-in-windows), [Make window always on top?](http://superuser.com/questions/28907/make-window-always-on-top) – Bob Jul 22 '14 at 04:04
  • I remember old version of NVidia control panel allowing to do this (with adding a toolbar in the window's title bar). 3-rd party app may exist for that purpose. – piernov Jul 22 '14 at 10:52

1 Answers1

1

There is no global setting for this. The applications itself must support this (set the wndTopMost flag) and must give you an option whether you want this feature or not (like Taskmgr.exe)

magicandre1981
  • 97,301
  • 30
  • 179
  • 245
  • It's possible to inject this flag from another program. In fact, fairly trivial. – Bob Jul 22 '14 at 04:04
  • @bob injecting 3rpd party code is possible but an ugly hack which can cause system stability issue, that's why I don't post this as suggestions. – magicandre1981 Jul 22 '14 at 04:05
  • `wndTopMost` is not fully correct - that's purely a MFC thing. The correct Win32 function is [`SetWindowPos`](http://msdn.microsoft.com/en-us/library/windows/desktop/ms633545%28v=vs.85%29.aspx) with `HWND_TOPMOST`. All it requires is a handle to the window (again easy, with [another Win32 function](http://msdn.microsoft.com/en-us/library/windows/desktop/ms633497%28v=vs.85%29.aspx)), actually, and there's nothing really unsafe about calling this from a process that does not own the window. It's not an ugly hack, and there's no "code injection" going on. – Bob Jul 22 '14 at 04:12
  • The only potential instability is if the target window somehow relied on *not* being on top (and I can't think of any reason that would happen). And even then that's not system instability, just the one application. – Bob Jul 22 '14 at 04:14