There're only two API calls to get a Windows coordinates (and a few others
which return both of these at once).
One is GetClientRect which returns the window extent (0,0-width, height) and
the other is GetWindowRect which returns (left, top-right, bottom).
My problem is I need to reposition controls on a dialog and neither of these
provide the child control coordinates relative to the parent window.
I have tried GetWindowRect for both parent and child and subtracting.
Unfortunately this seems to include the border and stuff. Is there a
border/window style indepenent way of getting a child controls coordinates
relative to the parent.
MoveWindow usually accepts screen coords unless it's a child window, in
which case it'll only accept client coordinates (which appear to be relative
to the client area of the parent, i.e. excluding borders).
Cheers
Leto
ClienToScreen & ScreenToClient are probably the missing links (APIs)
you need.
Dave
> ClienToScreen & ScreenToClient are probably the missing links
> (APIs) you need.
Alternatively, you can use MapWindowPoints() instead, ie:
RECT r = {0};
::GetClientRect(hWnd, &r);
::MapWindowPoints(hWnd, ::GetParent(hWnd), (LPPOINT) &r, 2);
--
Remy Lebeau
"Remy Lebeau" <no....@no.spam.com> wrote in message
news:eHZLkhha...@TK2MSFTNGP03.phx.gbl...