我写的一个黑白棋子,用vc++写的,编译环境是s2010旗舰版,其中电脑下棋时需要向棋盘中指定坐标发送鼠标单击事件,用来模拟人单击鼠标放棋子,请问我如何实现?网上说貌似可以用Sendmessage(),可是我对里面的参数不是很理解,用的时候程序崩溃。谁能指教一下我应该怎么实现。刚刚学mfc,希望大家说的详细点,最好给点例子,小弟坐等
解决方案 »
- 结构化存储 根存储下的流 修改时间不正确?
- CListCtrl 删除每行数据
- MFC的static控件问题
- ado 查询通不过,很郁闷,请高手帮解决一下。。。谢过了先(在线等)
- 我想做一个像拼音输入法那样的灰色的可翻页的小窗口,上面可显示汉字,并且汉字可选择,就像汉字输入法那样的,请给点思路,我是新手,请
- 如何动态修改控件的字体及颜色?
- SDI与MDI在编程中的区别?视和文档呢?
- 清华学生,你们真丢尽了中国学生\中国人的脸!
- 求助高手帮忙啊
- 运动目标检测追踪
- 在一个工程中建个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.