I’m trying to determine the window position of an application. I know SetWindowPos() would set the window position at a certain position with a specific sizing. I would like to retrieve this information, but I have noticed some negative values in there. When I save these values into the registry and then load them on the next instance, I can’t replicate the sizing and placement information accurately. Is this even the most accurate function to be used in the first place?
Thanks.
You should be calling the GetWindowPlacement method to get the WINDOWPLACEMENT structure which has not only the window position, but the state of the window (minimized, maximized, etc, etc).
In turn, you should store this information in the registry in addition to the position values and set the state of the window when reading the values back from the registry.