我写的一个黑白棋子,用vc++写的,编译环境是s2010旗舰版,其中电脑下棋时需要向棋盘中指定坐标发送鼠标单击事件,用来模拟人单击鼠标放棋子,请问我如何实现?网上说貌似可以用Sendmessage(),可是我对里面的参数不是很理解,用的时候程序崩溃。谁能指教一下我应该怎么实现。刚刚学mfc,希望大家说的详细点,最好给点例子,小弟坐等
解决方案 »
- 寂寞编程设置焦点到文本控件,但遇到意想不到的问题。
- vc 获取acpi信息,各位大虾,请帮助我,谢谢
- cannot convert parameter 1 from 'char [128]' to 'const unsigned short *'
- 趁假期自学mfc,入门小问题,不知道代码写在哪里才能运行
- 请问怎样实现视图的比例缩放,请高手指点
- 如何在服务器端发布.ocx控件????
- 求开发word浏览器的资料
- 在com中要访问数据库,使用sql来访问.BSTR的串接问题 。在线等待!!急!
- 请教:对话框中什么控件可以曲线?
- VS2005对子对话框双击出现的类向导,基类下拉框一直为空?
- 在一个工程中建个CFormView类和一个CListCtrl类,传值问题头痛该怎么解决
- 请问多多少少开发过网络游戏的程序员:开发网络游戏一般可选的编程语言有哪些,大概的优缺点是什么
The WM_LBUTTONDOWN message is posted when the user presses the left 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_LBUTTONDOWN
WPARAM wParam, // key indicator
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. Return Values
If an application processes this message, it should return zero. Res
Use the following code to obtain the horizontal and vertical position:xPos = GET_X_LPARAM(lParam);
yPos = GET_Y_LPARAM(lParam);
You can also use the MAKEPOINTS macro to convert the lParam parameter to a POINTS structure. To detect that the ALT key was pressed, check whether GetKeyState(VK_MENU) < 0. Note, this must not be GetAsyncKeyState.
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.You can also use the MAKEPOINTS macro to convert the lParam parameter to a POINTS structure.