I need to extract the cursor image for using it in my swing application (Java).
Firstly, I found similar question, modified code snippet from an answer, and got this sandbox application.
Shortly, it gets cursor image via JNA and WinAPI, then shows this image on JFrame and sets custom cursor for this frame.
In most cases, this code works correctly and suits my tasks. But then I found that when the user changes the cursor's size or color(Windows 10 feature), the program extracts an invalid cursor image that matches the original cursor neither in color nor in size.
When the user has standard cursor:
When the user has e.g. pink cursor then bigger than standard one:
After this situation, I decided to do the same sandbox application, but via C++ and WinAPI. I used answers for this question, but solved only troubles with color.
I think the main bottleneck is that GetSystemMetrics
function returns default cursor size (32x32) and it doesn't change after the cursor's size changing. I found some proves for this here, but I'm not sure.
So my question is:
How can I get the real size of cursor?
Thanks a lot in advance!