Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Very negative values from GetWindowRect for Explorer windows when using VirtuaWin

I'm hacking together something that lists every window on my Windows box, and it seems that for (only) one of my windows GetWindowRect is returning a rectangle with very negative y-coordinates.

Possible complications: (1) I have multiple monitors but (1a) the y-coordinate is very negative, on the order of -24000, and (1b) other windows, on both monitors, don't show this effect; (2) I am using the VirtuaWin virtual desktop tool but (2a) other windows, on multiple different virtual desktops and both monitors, don't show this effect; (3) I'm doing all this in Python, using the pywin32 modules.

The window in question is a Windows Explorer window. It isn't unusually sized or placed (by eye, at least). Explorer windows on the currently active virtual desktop don't show this behaviour, but when I create Explorer windows on other virtual desktops they show the same unexpected effect.

I'm running Windows XP, and version 4.3 of VirtuaWin.

So, what's going on?

like image 609
Gareth McCaughan Avatar asked Oct 25 '22 19:10

Gareth McCaughan


1 Answers

So, it turns out that it's nothing to do with Python or multiple monitors. VirtuaWin has two different ways of hiding windows on non-current virtual desktops. One of them involves hiding windows; the other involves messing with their coordinates to move them offscreen.

The coordinate-mangling technique is used for Windows Explorer windows (and also, I believe, windows for some versions of Internet Explorer) because these applications, if you hide a window and then make a new one, close the previously hidden window!

Accordingly, versions of VirtuaWin from 2.6 onwards move windows belonging to these applications offscreen rather than hiding them.

The effect is that these windows' y-coordinates have 25000 subtracted from their "true" values.

like image 149
Gareth McCaughan Avatar answered Oct 27 '22 10:10

Gareth McCaughan