c++ 中的鼠标单击位置
有没有办法在 C++ 控制台应用程序中获取鼠标单击位置(x 和 y)?
Is there way to get mouse click postion (x & y) in c++ console application?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
有没有办法在 C++ 控制台应用程序中获取鼠标单击位置(x 和 y)?
Is there way to get mouse click postion (x & y) in c++ console application?
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(3)
在 Unix 系统上,ncurses 库用于您可以在您的计算机上执行的任何奇特的操作。终端。
也应该可以在 Windows 上使用它们。
On Unix systems the ncurses library are used for any fancy stuff you could do on your terminal.
It should also be possible to use them on Windows.
假设 Windows:使用 ReadConsoleInput()。这将为您提供带有键盘和鼠标事件的 INPUT_RECORD 数组。使用 GetStdHandle() 获取调用此函数所需的标准输入句柄。
Assuming Windows: use ReadConsoleInput(). That gets you an array of INPUT_RECORD with keyboard and mouse events. Use GetStdHandle() to get the stdin handle you'll need to call this function.
使用控制台自己的键盘和鼠标事件处理程序 -
ReadConsoleInput( )
在此处了解更多信息 https://msdn.microsoft.com/en-us/library/windows/desktop/ms685035(v=vs .85).aspx
Use the consoles own event handler for keyboard and mouse -
ReadConsoleInput( )
Read more here https://msdn.microsoft.com/en-us/library/windows/desktop/ms685035(v=vs.85).aspx