a、取得窗口相对坐标
b、读出游戏窗口信息GetWindowRect
c、移动鼠标指针SetCursorPos
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 |
HWND
gameh; //游戏窗口句柄 RECT r1; //RECT结构表示一个矩形区域 void
CFewDlg::OnStartGame() { gameh=::FindWindow(NULL, "井字棋" ); ::GetWindowRect(gameh,&r1); this ->m_x=r1.left; this ->m_y=r1.top; UpdateData( false ); //显示到编辑框 SetCursorPos(655+r1.left,577+r1.top); //当前窗口坐标+开局按钮坐标 } void
CFewDlg::OnButton1() { OnStartGame(); } |
原文:http://www.cnblogs.com/zjutlitao/p/3622030.html