GET_X_LPARAM function

int GET_X_LPARAM(
  1. LPARAM lp
)

Retrieves the signed x-coordinate from the specified LPARAM value.

Use this macro instead of LOWORD when extracting cursor x positions from Windows messages (e.g., WM_MOUSEMOVE, WM_LBUTTONDOWN). Unlike LOWORD, this macro correctly returns negative coordinates, which occur when a secondary display is positioned to the left of the primary display.

Implementation

//
// #define GET_X_LPARAM(lp)  ((int)(short)LOWORD(lp))
@pragma('vm:prefer-inline')
int GET_X_LPARAM(LPARAM lp) => LOWORD(lp).toSigned(16);