C++模拟鼠标移动
用以下代碼可實現C++模擬鼠標移動:
#include <iostream> #include <Windows.h>void Mouse_Move(int x, int y) {double fScreenWidth = ::GetSystemMetrics(SM_CXSCREEN) - 1;double fScreenHeight = ::GetSystemMetrics(SM_CYSCREEN) - 1;double fx = x * (65535.0f / fScreenWidth);double fy = y * (65535.0f / fScreenHeight);mouse_event(MOUSEEVENTF_ABSOLUTE | MOUSEEVENTF_MOVE, fx, fy, 0, 0); }int main() {POINT p;::GetCursorPos(&p);Mouse_Move(p.x+50, p.y+50);return 0; }?
總結
- 上一篇: 计算机一级考试教学设计,《全国计算机一级
- 下一篇: C++ —— C++内联函数