问题相关代码,请勿粘贴截图
#include<windows.h>
HANDLE hin=GetStdHandle(STD_INPUT_HANDLE),hout=GetStdHandle(STD_OUTPUT_HANDLE);
INPUT_RECORD Buf;
//隐藏光标
void HideCursor(){
CONSOLE_CURSOR_INFO CursorInfo;
GetConsoleCursorInfo(hout,&CursorInfo);
CursorInfo.bVisible = 0;
SetConsoleCursorInfo(hout,&CursorInfo);
}
int main(){
HideCursor();
while(1){
ReadConsoleInput(hin,&Buf,64,NULL);
std::printf("x:%d y:%d",Buf.Event.MouseEvent.dwMousePosition.X,Buf.Event.MouseEvent.dwMousePosition.Y);
Sleep(1000);
}
}
运行结果及报错内容
Segmentation fault
我的电脑是64位系统