9
1
Where is the information about the position of a window stored?
An example: I start notepad.exe
, and it starts neither minimized or maximized, but just a medium size window in the center of the screen. If I close it and start it again, it is at the same XY coordinates. But then if I close it while it is at the bottom of the screen, it will start up again at the bottom (as opposed to the midlle) of the screen.
If I wanted to manually change the XY positions of a window so it were to open up at a non-standard location, what would I need to edit?
Probably the registry, but where?
So each program has to handle its own positioning data?? – BenjiWiebe – 2013-01-11T03:24:34.627
I was hoping that Windows handles it. But I got a brainwave. I compiled a very basic Win32 GUI program, and looked through the code to locate position setting code. All I found was a line that told Windows to position the program. Windows then positioned the program like any console program -- top left corner, then a little lower and to the right, and then lower again, until finally resetting it to the top left corner. Demo: type
start
10 times intotest.bat
and run it. – BenjiWiebe – 2013-01-11T03:32:39.417I just saw that iWindowPosX was set to fffffffd (4294967293) in my case. Any idea how that massive number works? – Karan – 2013-01-11T03:40:12.617
@BenjiWiebe They're different things: 1. If a program remembers a window's position so it can put it in the same place next time, then the program gets to choose how and where it saves the window coordinates and size. It could save the values in the registry, a text file, or some other way. 2. If you are writing a program that makes a window, you should be able to specify the window's position and size when you create the window. I guess if you don't specify them, Windows will choose a default placement like you describe. Perhaps you can get more specific guidance on a programming forum. – Bavi_H – 2013-01-12T04:55:18.540
@Karan That number is -3 when the bits are treated as a signed value. Briefly: imagine an odometer with eight reels, and each reel has the digits 0 to 9 then A to F on it. If you start at 00000000 then click the odometer backwards three times, you end up at FFFFFFFD. For more detail: learn about binary, hexadecimal, and two's complement. – Bavi_H – 2013-01-12T04:58:48.533