Chinaunix首页 | 论坛 | 博客
  • 博客访问: 4736832
  • 博文数量: 206
  • 博客积分: 5240
  • 博客等级: 大校
  • 技术积分: 3224
  • 用 户 组: 普通用户
  • 注册时间: 2010-08-12 21:40
文章分类

全部博文(206)

文章存档

2013年(13)

2012年(8)

2011年(33)

2010年(152)

我的朋友

分类:

2011-04-29 03:12:07

教学目标:模拟鼠标操作
首先;用SPY++分析游戏数据
取得信息:a 窗口相对坐标
        b 读出游戏窗口信息GetWindowRect(窗口,地址)
        c 移动鼠标指针SetCursorPos(硬件模拟)

HWND FindWindow(
   LPCTSTR lpClassName,//窗口类名
   LPCTSTR lpWindowName//窗口标题
)

学习过程:
取 游戏标题 QQ游戏 - 连连看角色版
取 开局所在的坐标 x=655 y=577 //lparam 0x0241028f
拦截消息 WM_LBUTTONDOWN,WM_LBUTTONUP
api- FindWindow(NULL,QQ游戏 - 连连看角色版)

用到下面三个API函数
FindWindow,GetWindowRect,SetCursorPos

相关代码:

// the minimized window.

HCURSOR CLlk_wgDlg::OnQueryDragIcon()
{
    return (HCURSOR) m_hIcon;
}
 HWND gameh;
 RECT r1;//游戏坐标
void CLlk_wgDlg::OnStartGame()
{
    // TODO: Add your control notification handler code here

    //获取游戏窗口句柄

    gameh=::FindWindow(NULL,"QQ游戏 - 连连看角色版");
    ::GetWindowRect(gameh,&r1);
    this->m_x=r1.left;this->m_y=r1.top;
    UpdateData(false);
    //设置鼠标指针位置 取开局所在坐标:x=655;y=577 //lparam 0x0241028f

    SetCursorPos(655+r1.left,577+r1.top);
    
}


AAuto 代码
阅读(2293) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~