views:

2536

answers:

3

I know there is a function somewhere that will accept a client rect and it will convert it into a window rect for you. I just can't find / remember it!

Does anyone know what it is?

It will do something similar to:

const CRect client(0, 0, 200, 200);
const CRect window = ClientRectToWindowRect(client);
SetWindowPos(...)
+2  A: 

You're probably thinking of AdjustWindowRectEx(). Keep in mind, this is intended for use when creating a window - there's no guarantee that it will produce an accurate set of window dimensions for an existing window; for that, use GetWindowRect().

Shog9
A: 

Is this what you are looking for?

ClientToScreen

http://msdn.microsoft.com/en-us/library/ms532670(VS.85).aspx

Ken
Nope, that takes client coordinates and converts them to screen coordinates.
Mark Ingram
This doesn't account for the window borders. I had the same answer until I realized my mistake.
Mark Ransom
A: 

If you want to map client co-ordinates to window co-ordinates use the ClientToWindow API.

If you want to map client co-ordinates to screen co-ordinates use the ClientToScreen API.

jussij