Jump to content


Get Window default Size and Position

  • Please log in to reply
6 replies to this topic

#1 KaFu


    Hey, it's just me, KhaFoo...

  • MVPs
  • 3,423 posts

Posted 22 November 2011 - 10:56 AM


does anyone know if there is a way to get the default Size and Position of a Window (used during the CreateWindow call)?

Best Regards

#2 guinness


    all-consuming swarm in inconspicuous disguise

  • Developers
  • 18,235 posts

Posted 22 November 2011 - 11:03 AM

Have you looked at _WinAPI_GetClientRect?

Ref: http://stackoverflow.com/questions/61555...-and-height-from-createwindowe

Edited by guinness, 22 November 2011 - 11:06 AM.

UDF List:
Updated: 02/04/2015

#3 KaFu


    Hey, it's just me, KhaFoo...

  • MVPs
  • 3,423 posts

Posted 22 November 2011 - 11:07 AM

This one returns the current Size and Position, I'm looking for a way to retrieve the default / initial values. As far as I can see it's not possible to obtain these values, seems like they're not stored anywhere accessible :D...

Edited by KaFu, 22 November 2011 - 11:08 AM.

#4 Manadar



  • MVPs
  • 10,946 posts

Posted 22 November 2011 - 11:25 AM

1) This is an option which users can set. Windows keeps track of the window size and location on a per-window basis, might also be per-application basis.

2) If this option is enabled, the data is stored somewhere in the registry.

Tip: CCleaner can delete these registry values for you. If you enable this as the only option in CCleaner, it will tell you which registry keys it has deleted. From there it is probably much easier to figure out a way to read the values yourself.

Edit: http://support.microsoft.com/kb/235994/en-us Not sure if relevant.

Edited by Manadar, 22 November 2011 - 11:27 AM.

#5 KaFu


    Hey, it's just me, KhaFoo...

  • MVPs
  • 3,423 posts

Posted 22 November 2011 - 12:19 PM

Thanks for this hint. As far as I can see these registry values contain size & position of OS related windows like explorer and control panel windows only. Also I found a ref that this has been changed in Vista+, so I guess no luck here.

#6 lesolutionneur



  • Active Members
  • 35 posts

Posted 28 April 2012 - 11:31 PM

I've the solution for you:
-download regshot
-install it
-make a first snapshot changing directory to C:/ (and stop all process that could modify the registry as AVs)
-open the program, move the window
-make a second snapshot
-see what has been modified and where and if it is the window's position then you found it ;)

#7 JohnOne


    Number #1

  • Active Members
  • PipPipPipPipPipPip
  • 14,511 posts

Posted 18 June 2012 - 12:29 AM

If you were to create a hidden window with that call, using the CW_USEDEFAULT constant for x,y,w,h
and used wingetpos, would that not give you the default position?

AutoIt Absolute Beginners    Require a serial    Pause Script    


Monkey's are, like, natures humans.

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users