5
votes

On a machine with a high DPI monitor connected when I try to get the cursor (though GetIconInfo or GetIconInfoEx) I get an HBITMAP which is 3 times the normal size.

Is there a way to get a cursor normal size so that I don't have to resize it myself?

I get artifacts when I resize it my self

Since it was marked as duplicate question (Load cursor with certain resolution), let me explain why it's not:

First of all I am not loading any cursor. I'm using the system's default. Also when I query the system for the cursor size, whether the cursor is on a hi-DPI or normal-DPI monitor I always get 64 pixels, the same value. Also I get the same value whether I have from control panel the monitor's scaling factor to 100% or more. Also the same value I get whether or not I have small, medium or large cursor (from control panel mouse ease of access)

1

1 Answers

0
votes

You do not state what normal size refers to, so I'm going to assume, that it's the cursor size that the hardware mouse pointer is displayed at (32×32 at 96 DPI 100 % scale).

Dimensions of the bitmap returned by GetIconInfo (and the cursor itself) is affected by the DPI-scale specified in the control panel, which can be depending on Windows version same for the whole system or vary between monitors. Additionally the bitmap size is also affected by whether or not your application is marked as DPI-aware, otherwise Windows scales everything for the application.

DPI scale Mouse cursor size DPI aware GetIconInfo bitmap
100 % 32×32 - 32×32
150 % 48×48 No 72×72
150 % 48×48 Yes 48×48
200 % 64×64 No 128×128
200 % 64×64 Yes 64×64