[外挂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();
}
原文地址:https://www.cnblogs.com/zjutlitao/p/3622030.html