c 实时显示鼠标地址
最近在学习c,练习项目
#include <stdio.h>
#include<windows.h>
int main(int ac,char **pav)
{
LONG x=-1, y=-1;
POINT pt= {0,0};
for(;;){
GetCursorPos(&pt); //获取鼠标当前位置
if ((x!=pt.x) || (y!=pt.y)) //如果位置与之前的位置不一样则输出新位置
{
system("cls");
printf("x=%d,y=%d\n",pt.x, pt.y);
x=pt.x,y=pt.y;
}
}
return 0;
}
A lion doesn't concern himself with the opinions of a sheep.