检测鼠标位置
2025-04-23 15:01:11
发布于:广东
屏幕上的:
初始:
#include<windows.h>
POINT p;
侦测:
GetCursorPos(&p);
调用:
p.x
p.y
窗口上的:
初始:
#include<windows.h>
POINT p;
HWND h=GetForegroundWindow();
侦测:
GetCursorPos(&p);
ScreenToClient(h,&p);
调用:
p.x
p.y
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
如果你 不是S* 善于思考,辣么你会发现乐事像素,
蒜乐,本大帅锅大发慈悲告诉你吧。
获取字体的高和宽:
初始:
HANDLE hOutput = GetStdHandle(STD_OUTPUT_HANDLE);
CONSOLE_FONT_INFO consoleCurrentFont;
侦测:
GetCurrentConsoleFont(hOutput,FALSE,&consoleCurrentFont);
调用:
consoleCurrentFont.dwFontSize.X //获取宽
consoleCurrentFont.dwFontSize.Y //获取高
这里空空如也
有帮助,赞一个