englm
asked on
VC++ - problem with GetWindowRect()
I am trying to move an object on top of another object in a view window. I am positioning the second object based on the coordinates returned by GetWindowRect() of the first object. This works fine when the manin view is maximized, however when the view is made smaller so that scroll bars appear, the GetWindowRect() coordinates do not seem to be right. When I try to put the second object to a position of
object1rect.top (which is of CRect type) they do not match up. How can get an accurate position of the first object to determine where to put the second?
object1rect.top (which is of CRect type) they do not match up. How can get an accurate position of the first object to determine where to put the second?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I'm not sure exactly what the two coordinate sytems are doing, but it seemed to cure my problem.
They aren't "doing" anything. Its just the fact that the rectangle's position is measured from different points at different times.
Note, if the parent window is maximized, then its client area's top-left corner is almost at the screen's top-left corner. Thus the two coordinate systems are almost aligned. That is why you don't see the problem with a maximized parent window. However, the problem was still there.
If you have any questions, ask.