一个关于获取鼠标位置的问题
#include <iostream.h> #include <windows.h>int main() { POINT p; //定义一个点 while(true) { if(GetCursorPos(&p)) { cout<<"当前鼠标位置:"<<p.x<<","<<p.y; Sleep(500); system("cls"); } }}#include <iostream.h> #include <windows.h>int main() { POINT p; //定义一个点 while(true) { if(GetCursorPos(&p)) { cout<<"当前鼠标位置:"<<p.x<<","<<p.y<<endl; Sleep(500); system("cls"); } }}
[解决办法]
用一个计时器嘛,每隔0.x秒执行一次
[解决办法]
我也想知道,望高手指点。
[解决办法]
#include <iostream>#include <windows.h>using namespace std;int main(){ POINT p; //定义一个点 while (true) { if (GetCursorPos(&p)) { cout << "当前鼠标位置:" << p.x << "," << p.y; Sleep(500); system("cls"); } }}