鼠标模拟

鼠标模拟
 1
 2 void  GameStart()
 3 {
 4    HWND hGame= ::FindWindow(NULL,_T("超级玛丽专用辅助"));
 5    CRect rect;
 6    GetWindowRect(hGame,&rect);
 7
 8    POINT ptNow//模拟之前鼠标的位置
 9        ,pt;//要模拟的位置
10
11    GetCursorPos(&ptNow);//保存模拟之前的鼠标位置
12    pt.x = rect.left + 213;
13    pt.y = rect.top + 370;
14    SetCursorPos(pt.x,pt.y);//新的位置
15    mouse_event(MOUSEEVENTF_LEFTDOWN,0,0,0,0);
16    mouse_event(MOUSEEVENTF_LEFTUP,0,0,0,0);
17    SetCursorPos(ptNow.x,ptNow.y);//恢复模拟之前的鼠标位置
18}

19

你可能感兴趣的:(鼠标模拟)