0

I would like to be able to set any window (for example Google Chrome) to be always below all other windows and prevent it to come to the top when activated. I found this on stackoverflow. What I am looking for is nearly the same, but for compiled applications. Using Ubuntu I could achieve this using wmctrl -i -r <window_handle> -b add,below but I found no corresponding possibility under Windows (in my case Windows 7 x64).

Community
  • 1
  • 1
loafer
  • 146
  • 1
  • 4

1 Answers1

0

I could not find such a command line function but you could still do it from a compiled program.

First find Google Chrome's window handle: Source

The only way I know of is to enumerate all the top level windows with EnumWindows() and then find what process each belongs to GetWindowThreadProcessID(). This sounds indirect and inefficient, but it's not as bad as you might expect -- in a typical case, you might have a dozen top level windows to walk through...

Then use SetWindowPos with the flag HWND_BOTTOM for that HWND. The user might try to bring Chrome to the foreground which you could prevent by checking GetForegroundWindow and if necessary call SetWindowPos again.

Community
  • 1
  • 1
Eejin
  • 770
  • 1
  • 8
  • 29
  • I had a similar approach using http://www.commandline.co.uk/cmdow/ but the main problem was that the window always flashed to the top before it got forced to the bottom again. – loafer May 06 '14 at 15:25