Per the documentation for WM_NCHITTEST on MSDN, use GET_X_LPARAM
and GET_Y_LPARAM
from windowsx.h instead of LOWORD
and HIWORD
to get coordinate values from an LPARAM
. You can convert the coordinates to client coordinates if you really want to by storing them in a POINT
and then calling ScreenToClient
like this:
POINT pt;
pt.x = GET_X_LPARAM(lParam);
pt.y = GET_Y_LPARAM(lParam);
ScreenToClient(hWnd, &pt);
However, I'm not sure there's a real benefit to doing that here. Notably, the client area begins inside the window frame, so (0, 0) in client coordinates is not the upper left corner of the window.
Probably what you really want is GetWindowRect
, which gives you the bounding rectangle of the whole window in screen coordinates. You can figure out from there what the top 50 pixels are.