我想在屏幕上移动鼠标,我使用此代码:
#include <windows.h>
int main(int argc, int *argv[]){
POINT pt;
GetCursorPos(&pt);
printf("Current cursor position (%d, %d)\n", pt.x, pt.y);
pt.x = 100;
pt.y = 100;
SetCursorPos(pt.x, pt.y);
GetCursorPos(&pt);
printf("Current cursor position (%d, %d)\n", pt.x, pt.y);
system("pause");
}
此脚本有效我看到位置发生变化,但鼠标不在屏幕上移动。我应该使用其他功能来移动光标吗?