[外挂1] MFC 鼠标位置设置
a、取得窗口相对坐标
b、读出游戏窗口信息GetWindowRect
c、移动鼠标指针SetCursorPos


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();
}

浙公网安备 33010602011771号