我用SPY++模拟点击连连看的棋盘..我看示例代码上面左移 16位置;我一直没理解这个左移16位什么意思为什么要进行左移? 请高手帮忙解惑一下..!
SendMessage(hwnd,WM_LBUTTONDOWN,0,(y<<16)+x+31*2);//
SendMessage(hwnd,WM_LBUTTONUP,0,(y<<16)+x); //
SendMessage(hwnd,WM_LBUTTONDOWN,0,(y<<16)+x+31*2);//
SendMessage(hwnd,WM_LBUTTONUP,0,(y<<16)+x); //
LPARAM lParam = MAKELONG(x, y);
SendMessage(hwnd,WM_LBUTTONDOWN,wParam,lParam);//
1: 既然Y= 191 .左移16位有+x 这样坐标就是 YX了.. 这样做是什么意义?
我调试程序这样是没问题的.的确可以点到..按照正常的理解来说.应该X在前.Y在后面...2: SendMessage的第四个参数是 lparam类型.他却定义成整形.我查了MSDN的LPARAM的类型.讲是结构体.函数的返回值. 很抽象.本人英语很菜..void CLlk_wgDlg::OnButton3()
{
// TODO: Add your control notification handler code here
int x=24,y=191;
HWND hwnd=::FindWindow(NULL,gameCaption);
int lparam;
lparam=(y<<16)+x+31*2;//表示指定格
::SendMessage(hwnd,WM_LBUTTONDOWN,0,lparam);//
::SendMessage(hwnd,WM_LBUTTONUP,0,lparam); // }
x和y用十六二进数九可以表示
现在有一个32位的数
想同时保存x和y怎么办?
可以在高十六位存y在低十六位存x
这样x、y互不影响
接到这个数后我们也可以清晰地把他们分离出来
1. 这样做的意义就是可以把尽可能多的信息用一个参数传递过去
然后,确实是Y在高位,X在低位。CSDN说明如下:
lParam
The low-order word specifies the x-coordinate of the cursor. The coordinate is relative to the upper-left corner of the client area.
The high-order word specifies the y-coordinate of the cursor. The coordinate is relative to the upper-left corner of the client area. 2. LPARAM 是一个32位数据,整型也是32位数据,两个值可以转换
LPARAM A 32-bit value passed as a parameter to a window procedure or callback function.