Determining if a window is visible
- Posted by marky1124 Jul 23, 2009
- 905 views
Hi,
I'd like to know whether a window is positioned such that it is within the current visible windows desktop. This applies to a dual screen scenario. Sometimes a laptop user will move desk, previously they had their external monitor to the left of their laptop and used a dual screen setup like that, now they've moved desk and their external monitor is to the right of their laptop. My application remembers where a window was placed last time and then positions it in the same place next time it is opened. In this scenario the user can't get to the window that has been positioned to the left of their main screen. I'd like to be able to make the code realise that the saved location is outside of the current visible desktop. I've tried using isVisible(myWin) but that's related to the isVisible(myWin, w32True) setting rather than the position on the virtual desktop.
Any anyone help please?
Cheers, Mark
Here's a few snippets to illustrate the code I'm using
E.g. on closing window, it's position is stored in a config file
myWindowRect = getWindowRect(myWin) writeINI(ConfigFile, "Location", "myWinRect", myWindowRect)
Another day on opening that window it is positioned in the previously recorded location
myWindowRect = readINI(ConfigFile, "Location", "myWinRect", "None") if not equal("None", lTmp) then setWindowRect(myWin, myWindowRect) end if