How to use ScreenToClient

I’m trying to convert a point with the ScreenToClient function. I don’t know what the parameters are supposed to be. Any help would be greatly appreciated.

POINT mpos; // Mouse Position
POINT cur_mpos; // Temp Var for Testing

GetCursorPos(&mpos);
cur_mpos = ScreenToClient(hWnd, mpos);

error C2664: ‘ScreenToClient’ : cannot convert parameter 2 from ‘struct tagPOINT’ to ‘struct tagPOINT *’

ScreenToClient(hWnd, &mpos);

mpos will now have the converted coordinates. It returns TRUE or FALSE to tell you if it was successful or not, not the new position.

From MSDN:

BOOL ScreenToClient(
HWND hWnd,
LPPOINT lpPoint );

Don’t take this the wrong way, but you really should concentrate on learning C/C++ and the Win32 API before trying to get too far into OpenGL. It’ll help you out a lot in the long run. While you’re at it, familiarize yourself with MSDN, it’s an invaluable refrence. Simple questions like this really aren’t OpenGL questions, but a lack of understanding of the language.

You should look more exatcly into the error message that got produced…

it has to be
cur_mpos = ScreenToClient(hWnd, &mpos);

That was double-post Deissum…

I did look at the MSDN, but I must have missed the bool infront of ScreenToClient. That was my fault. Thank you for the correction. But I did need to know what I should have used for lpPoint. That clarifies a few things. Thanks.

The LP on things is a Win32 naming convention meaning a “long pointer.” Whenever you see something like LPPOINT, you should think POINT*. Learn Win32 a bit better and you’ll start to understand the naming conventions.