Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Repositioning a Window and Dual Monitors
Message
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00746092
Message ID:
00748761
Views:
16
Matt, since no one else has replied I'll take a stab at it (I clearly have too much time on my hands :)

It seems to me that you need a way to determine if you are running in dual monitor mode or not. Once you know that then you would switch off the AUTOCENTER property of your form and replace that with calculated TOP and LEFT properties for the form:
LEFT = ( nScreenWidth  - THIS.WIDTH  ) / 2     
TOP  = ( nScreenHeight - THIS.HEIGHT ) / 2   
(For non-top level forms you would need to modify these formulas to adjust for main window title bar, menu bar, and any toolbars you had open. For top level the above should be ok).

The news2news site has a great example of using Win API functions to retrieve detailed info about your screen driver and resolution which hopefully will give you answers to calculating the nScreenWidth and nScreenHieght values.

If you cannot get the correct screen width and height directly you could instead test the video device name and/or adapter to see if you are in dual monitor mode. If so then double the SYSMETRIC() values.

Check out:

http://www.news2news.com/vfp/?example=374&function=574



>The app that I'm working on has the ability to remember it's window position & will re-position itself upon startup, to its last position. All's well with that. But, I sometimes run the app on dual monitor systems. The main window behaves as it should & positions itself properly if it was left within the 2nd monitor. The problem comes in with top level windows that are called from the main app & are set to autocenter. They _ALWAYS_ autocenter in the first window.
>
>Sysmetric(), AFAIK only returns information about the primary display.
>
>I can't seem to come up with a good solution to handle this. Has anyone else tackled this one already?
>
>Thanks much.
>
>-Matt
In the End, we will remember not the words of our enemies, but the silence of our friends - Martin Luther King, Jr.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform