Reputation: 1662
I am using a crude system to control a Flash movie from a C++/win32 program by sending WM_MOUSEMOVE events directly to the Flash window.
It works well for one axis:
SendMessage( m_targetWindowHWND, WM_MOUSEMOVE, 0, xpos);
However I'd like to now send both x and y values. I know these are packed into a WM_MOUSEMOVEs lparam. In C++ this could be unpacked with MAKEPOINTS or GET_X_LPARAM/GET_Y_LPARAM.
But how do I pack the x and y, basically doing the reverse of the macros above.
My guess:
DWORD packed = y << 8 + x;
Thanks
Upvotes: 3
Views: 4542
Reputation: 33607
The macro you're looking for is MAKELPARAM
:
http://msdn.microsoft.com/en-us/library/windows/desktop/ms632661(v=vs.85).aspx
LPARAM WINAPI MAKELPARAM(
WORD wLow,
WORD wHigh
);
I believe it's equivalent to MAKELONG
(same thing but returns a DWORD
), but then again...maybe there's a platform out there where a LPARAM and a DWORD are defined differently. :-/
EDIT: Apparently LPARAM (and WPARAM!) are nowadays both defined under the hood to be the size of pointers on your platform. The "L" (long) and "W" (word) are historical: What are the definitions for LPARAM and WPARAM?
Upvotes: 5