It is stored in registry :
HKEY_CURRENT_USER\SOFTWARE\Microsoft\Accessibility
CursorSize
or
HKEY_CURRENT_USER\Control Panel\Cursors
CursorBaseSize
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
How do i get correct size value of mouse pointer?
I have try: SystemParametersInfo() and cursor bitmap size info. They both return default values. Starting from win3.x
Now the Win10 has this change mouse cursor size feature. That make life more easy. But i din't find eny information
how to get correct size of mouse cursor if you are using large cursor.
The idea is scale to mouse cursor bitmap to correct size. Now this code is working but it use default 32x32 size.
static Bitmap? CaptureCursor(ref int x, ref int y)
{
Bitmap bmp;
IntPtr hicon;
CURSORINFO ci = new CURSORINFO();
ICONINFO icInfo;
ci.cbSize = Marshal.SizeOf(ci);
if (GetCursorInfo(ref ci))
{
if (ci.flags == CURSOR_SHOWING)
{
hicon = CopyIcon(ci.hCursor);
if (GetIconInfo(hicon, out icInfo))
{
x = ci.ptScreenPos.X - ((int)icInfo.xHotspot);
y = ci.ptScreenPos.Y - ((int)icInfo.yHotspot);
Icon ic = Icon.FromHandle(hicon);
bmp = ic.ToBitmap();
return bmp;
}
}
}
return null;
}
https://www.howtogeek.com/427263/how-to-change-the-mouse-pointer-color-and-size-on-windows-10/
It is stored in registry :
HKEY_CURRENT_USER\SOFTWARE\Microsoft\Accessibility
CursorSize
or
HKEY_CURRENT_USER\Control Panel\Cursors
CursorBaseSize
/*
The standard size is 32x32, even though the cursor is actually just
16 pixels large. If a large cursor is set in the accessibility settings,
then the cursor increases with 8 pixels for each step.
*/
QSize QWindowsCursor::size() const
{
const QPair<DWORD,bool> cursorSizeSetting =
QWinRegistryKey(HKEY_CURRENT_USER, LR"(Control Panel\Cursors)")
.dwordValue(L"CursorBaseSize");
const int baseSize = screenCursorSize(m_screen).width() / 2;
if (!cursorSizeSetting.second)
return QSize(baseSize / 2, baseSize / 2);
// The registry values are dpi-independent, so we need to scale the result.
int cursorSizeValue = cursorSizeSetting.first * m_screen->logicalDpi().first
/ m_screen->logicalBaseDpi().first;
// map from registry value 32-256 to 0-14, and from there to pixels
cursorSizeValue = (cursorSizeValue - 2 * baseSize) / baseSize;
const int cursorSize = baseSize + cursorSizeValue * (baseSize / 2);
return QSize(cursorSize, cursorSize);
}
In order to answer the question “What is the size of the mouse cursor?” you first have to specify which mouse cursor you are interested in, in the form of an HCURSOR. For example, if you are interested in the size of the arrow cursor, you can call LoadCursor(nullptr, IDC_ARROW).¹
Once you have your HCURSOR, you can call GetIconInfo² to obtain information about it. The bitmaps that are used to draw the cursor are available as the hbmMask and hbmCursor. Interpreting these bitmaps is a bit tricky.
For color cursors, the hbmMask and hbmColor bitmaps are the same size, each of which is the size of the cursor.
https://devblogs.microsoft.com/oldnewthing/20210820-00/?p=105593