Reset user system cursor in normal mode

I change the system cursor to SetSystemCursor, but when I try to reset, the system cursor to nornal with DestroyCursor nothing happens !!

Any ideas?

Thank!

+5
source share
2 answers

As indicated, the SetSystemCursor () function already destroys the passed cursor, so destroying it again will have no effect.

You will need to save a copy of the old cursor so that you can restore it later:

// Global Variables:
HCURSOR hOldCursor;
...
   hOldCursor = CopyCursor(LoadCursor(NULL, MAKEINTRESOURCE(IDC_ARROW)));
   HCURSOR hNewCursor = CopyCursor(LoadCursor(hInstance, MAKEINTRESOURCE(IDC_MYCURSOR)));
   SetSystemCursor(hNewCursor, OCR_NORMAL);

And restore it as follows:

SetSystemCursor(hOldCursor, OCR_NORMAL);
DestroyCursor(hOldCursor);
hOldCursor = NULL;

, , . . , , .

+4

, :

SystemParametersInfo(SPI_SETCURSORS, 0, NULL, 0);

SPI_SETCURSORS 0x0057,

+3

All Articles