Windows cursor size

Tuukka Lehtinen 21 Reputation points

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;

Windows API - Win32
Windows API - Win32
A core set of Windows application programming interfaces (APIs) for desktop and server applications. Previously known as Win32 API.
2,483 questions
0 comments No comments
{count} votes

Accepted answer
  1. Castorix31 82,501 Reputation points

    It is stored in registry :

    HKEY_CURRENT_USER\Control Panel\Cursors

1 additional answer

Sort by: Most helpful
  1. Dimitriy Ryazantcev 26 Reputation points
        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)")  
        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 Get­Icon­Info² 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.

    0 comments No comments