问题
I'd like to make the windows cursor bigger. I have a c++ windows application with the following code that I hijacked from a similar question. I am loading a cursor from a .cur file.
Already tried this link: The biggest size of Windows Cursor can't decide if the answer is "impossible" or "possible".
I've tried this and it doesn't work on windows 8 --> i'm loading a 128x128 file and it still appears very small (32x32). can anyone post something that has actually worked for them?
// load cursor resource into hCursor
HCURSOR ghTouchCursor = (HCURSOR)LoadImage(NULL, L"NormalHand.cur", IMAGE_CURSOR, 0,0, LR_LOADFROMFILE);
// must copy cursor, windows is a pita...
HCURSOR ghCopyTouchCursor = CopyCursor(ghTouchCursor);
// set the cursor as the new full-screen cursor
SetSystemCursor(ghCopyTouchCursor, 32512);
i've also tried calling the load image like this, no difference.
HCURSOR ghTouchCursor = (HCURSOR)LoadImage(NULL, L"NormalHand.cur", IMAGE_CURSOR, 128,128, LR_LOADFROMFILE);
GetSystemMetrics(SM_CXCURSOR) returns 32 but according to the official site: "SetSystemCursor... You can use this function to set a cursor of any size."
It seems like there is consensus around "impossible".
回答1:
The max cursor size depends on the system
The size in pixels of a cursor supported by the system can be retrieved by calling GetSystemMetrics, invoked with SM_CXCURSOR
for the width, and SM_CYCURSOR
for the height.
As stated by msdn this is the only size the system can use when creating cursors, which means that if you are using a bigger size in your call to LoadImage that will be ignored.
Any alternative solutions?
If you want a bigger cursor, but the system prevents you from creating one, an alternative would be to hide the current cursor, and have an image float around where the cursor actually is.
This way the user will think that the cursor has changed, but in reality the cursor is invisible, and a image has been set in its place.
来源:https://stackoverflow.com/questions/24117764/make-the-windows-cursor-bigger-on-windows-8