So lets start with the signature for SendMessage, from Pinvoke.net:
[DllImport("user32.dll", CharSet = CharSet.Auto)]
static extern IntPtr SendMessage(IntPtr hWnd, UInt32 Msg, IntPtr wParam, IntPtr lParam);
It taks a window handle, hWnd, a message ID, Msg, and two generic parameters wParam and lParam which change meaing based on the message ID.
What spy++ is showing you is the parameters that were sent to SendMessage. As you can see it doesn't show you wParam and lParam, but hwnd, nHittest, and wMouseMsg. That's because Spy++ knows what the wParam and lParam parameters actually mean for a WM_SETCURSOR message and is decoding them for you.
So decoding each piece of the what Spy++ has sent:
00220540
- the window handle receiving the message - the hWnd parameter.
S
- It means it was sent via
SendMessage() and not posted via
PostMessage(). See http://msdn.microsoft.com/en-us/library/aa265147(v=vs.60).aspx
WM_SETCURSOR
- The message ID - the
Msg parameter.
hwnd:0024052C
- handle of the Window
containing the cursor - the wParam
parameter.
nHittest:HTCLIENT
- the hit test
code - the low word of the lParam
parameter.
wMouseMsg:WM_MOUSEMOVE
- the mouse
message - the high word of the
lParam parameter.
The way you would go about sending the message to a window is:
enum WindowMessages {
WM_SETCURSOR = 0x0020,
WM_MOUSEMOVE = 0x0200,
....
}
enum HitTestCodes {
HTCLIENT = 1,
....
}
....
IntPtr hWnd = [get your window handle some how]
int lParam = ((int)WindowMessages.WM_MOUSEMOVE) << 16 + (int)HitTestCodes.HTCLIENT;
SendMessage(hWnd, (uint)WindowMessages.WM_SETCURSOR, hWnd, (IntPtr)lParam);
For understanding what other messages mean you can do a search on Msdn.com for the messsage in the Windows documentation.
So after answering all of that I don't think this will have anything to do with sending keys to the game you are trying to control. WM_SETCURSOR doesn't have anything to do with keyboard input.