-
-
[求助]SendMessage 最后一个参数的奇怪用法
-
发表于:
2009-7-23 17:29
5307
-
[求助]SendMessage 最后一个参数的奇怪用法
以下代码是在本论坛找的.是一个扫雷的自动实现代码
但是不明白颜色标的部分 请大家讲解一下,非常感谢!
for(int y=0;y<aa[1];y++)
{
for(int x=1;x<=aa[0];x++)
{
if(bb[x+(y*32)]==0x8f)
{//右键
::SendMessage((HWND__ *)(*wn),WM_RBUTTONDOWN,0,[COLOR="Red"](0x00400000+(y*0x00100000))|(0x0010*x));
::SendMessage((HWND__ *)(*wn),WM_RBUTTONUP,0,[COLOR="red"](0x00400000+(y*0x00100000))|(0x0010*x));
}
else
{//左键
::SendMessage((HWND__ *)(*wn),WM_LBUTTONDOWN,0,[COLOR="red"](0x00400000+(y*0x00100000))|(0x0010*x));
::SendMessage((HWND__ *)(*wn),WM_LBUTTONUP,0,[COLOR="red"](0x00400000+(y*0x00100000))|(0x0010*x));
}
}
}
上面代码中LPARAM 参数为 0x4xxx+xx 是一个内存地址. 实在看不明白.请大家帮帮忙...
函数原型:
LRESULT SendMessage(
HWND hWnd, // handle to destination window
UINT Msg, // message
WPARAM wParam, // first message parameter
LPARAM lParam // second message parameter
);
WM_RBUTTONDOWN
The WM_RBUTTONDOWN message is posted when the user presses the right mouse button while the cursor is in the client area of a window. If the mouse is not captured, the message is posted to the window beneath the cursor. Otherwise, the message is posted to the window that has captured the mouse.
A window receives this message through its WindowProc function.
LRESULT CALLBACK WindowProc(
HWND hwnd, // handle to window
UINT uMsg, // WM_RBUTTONDOWN
WPARAM wParam, // key indicators
LPARAM lParam // horizontal and vertical position
);
Parameters
wParam
Indicates whether various virtual keys are down. This parameter can be one or more of the following values. Value Description
MK_CONTROL The CTRL key is down.
MK_LBUTTON The left mouse button is down.
MK_MBUTTON The middle mouse button is down.
MK_RBUTTON The right mouse button is down.
MK_SHIFT The SHIFT key is down.
MK_XBUTTON1 Windows 2000/XP: The first X button is down.
MK_XBUTTON2 Windows 2000/XP: The second X button is down.
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.
通常来说我们模拟鼠标是 ::SendMessage((HWND__ *)(*wn),WM_LBUTTONDOWN,0,
坐标信息)
[培训]内核驱动高级班,冲击BAT一流互联网大厂工作,每周日13:00-18:00直播授课