[让我帮你bing一下](https://kaiy.moe/bang/?c%2B%2B%20%E6%A3%80%E6%B5%8B%E9%BC%A0%E6%A0%87)
by 6syano @ 2024-03-19 18:49:58
@[6syano](/user/937493) 这个咋做
by Dpf20120621 @ 2024-03-19 21:33:21
额, 我要的是鼠标在黑窗口的哪一个格子上(学校电脑限制网站...)@[6syano](/user/937493)
by Joker_Error_404 @ 2024-03-19 21:43:34
@[Joker_Error_404](/user/745288)
``x`` 表示是否为相对窗口的坐标
``n`` 表示是否将坐标转化为对应的格子(半角)
```
pair<int,int> getmouseposition(bool x=1,bool n=1)
{
HANDLE hOutput=GetStdHandle(STD_OUTPUT_HANDLE);
HWND h=GetForegroundWindow();
CONSOLE_FONT_INFO consoleCurrentFont;
POINT p;
if(x)
{
GetCursorPos(&p);
ScreenToClient(h,&p);
}
else
{
GetCursorPos(&p);
}
if(n)
{
GetCurrentConsoleFont(hOutput,FALSE,&consoleCurrentFont);
p.x/=consoleCurrentFont.dwFontSize.X;
p.y/=consoleCurrentFont.dwFontSize.Y;
}
return make_pair(p.y+1,p.x+1);
}
```
by zhanghuanrui @ 2024-03-20 07:44:48
@[zhanghuanrui](/user/570352)
感谢!!!
额...能不能设置黑窗口全屏?
by Joker_Error_404 @ 2024-03-20 12:36:51
@[Joker_Error_404](/user/745288) [让我帮你搜一下](https://baidu.physton.com/?q=c++ 检测鼠标)
by wph__hhh @ 2024-03-20 13:08:32
[让我帮你搜一下](https://baidu.physton.com/?q=后面加上你想搜的) @[Joker_Error_404](/user/745288)
对不起,上个没弄好。。。
by wph__hhh @ 2024-03-20 13:09:22
@[wph__hhh](/user/695154)
我网络被限制了...
by Joker_Error_404 @ 2024-03-20 13:28:10
@[Joker_Error_404](/user/745288) [sorry](https://baidu.physton.com/?q=c++查找鼠标)
[好可怜](https://baidu.physton.com/?q=好可怜)
[哈哈多发几个](https://baidu.physton.com/?q=哈哈多发几个)
~~幸灾乐祸~~
by wph__hhh @ 2024-03-20 13:33:04
@[wph__hhh](/user/695154)
打不开啊啊啊啊啊啊啊啊啊啊啊啊
by Joker_Error_404 @ 2024-03-20 13:36:18