Jump to content

WinMove to another window's client coords?

Go to solution Solved by somdcomputerguy,

Recommended Posts

I'm trying to move Window1 to the center of Window2 using Window2's size as a reference, something like:

While WinExists ("Window1")

     WinMove ("Window1", "", $Window2Width / 2, $Window2Height / 2)


I could just move Window1 by using desktop coordinates, but I'm looking for a nicer solution. Any ideas?

Link to comment
Share on other sites

Use WinGetPos() to get the size of Window2.


Oh wait... that would work because it would be grabbing the position using the desktop coords, then would move Window1 to those same desktop coords. So instead of moving Window1's coords using Window2 as a reference, both windows just use the desktop as a reference. Alright, thanks for the help!

Link to comment
Share on other sites

WinGetPos() returns a 4 element array - window position X & Y, window size width & height. See the Help file for details. The WinGetClientSize() function may be useful instead..

Edited by somdcomputerguy

- Bruce /*somdcomputerguy */  If you change the way you look at things, the things you look at change.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...