模拟键盘鼠标事件

keybd_event模拟键盘事件

 

SendInput

/*模拟鼠标单击100,200实例*/
INPUT input;
input.type = INPUT_MOUSE;
input.mi.dx = static_cast<long>(65535.0f / (GetSystemMetrics(SM_CXSCREEN) - 1) * 100);
input.mi.dy = static_cast<long>(65535.0f / (GetSystemMetrics(SM_CYSCREEN) - 1) * 200);
input.mi.dwFlags = MOUSEEVENTF_ABSOLUTE | MOUSEEVENTF_MOVE | MOUSEEVENTF_LEFTDOWN | MOUSEEVENTF_LEFTUP;
SendInput(1, &input, sizeof(INPUT));
posted @ 2014-12-03 09:50  酷熊  阅读(260)  评论(0编辑  收藏  举报