我正在尝试使用SetSystemCursor替换多个系统游标。我的第一个调用更改了OCR_NORMAL的光标,但后续的调用不起作用。

HCURSOR hWaitCur = LoadCursor(NULL, IDC_WAIT);
HCURSOR cursorCopy = CopyCursor(hWaitCur);

SetSystemCursor(cursorCopy, OCR_NORMAL); // This works

// Not working
SetSystemCursor(cursorCopy, OCR_APPSTARTING);
SetSystemCursor(cursorCopy, OCR_CROSS);
SetSystemCursor(cursorCopy, OCR_HAND);
SetSystemCursor(cursorCopy, OCR_HELP);
SetSystemCursor(cursorCopy, OCR_IBEAM);
SetSystemCursor(cursorCopy, OCR_NO);
SetSystemCursor(cursorCopy, OCR_WAIT);

一次更新多个系统游标的正确方法是什么?

最佳答案

docs(我强调):



因此,您需要在每次通话前复制它:

SetSystemCursor(CopyCursor(hWaitCur), OCR_NORMAL);
SetSystemCursor(CopyCursor(hWaitCur), OCR_APPSTARTING);
SetSystemCursor(CopyCursor(hWaitCur), OCR_CROSS);
SetSystemCursor(CopyCursor(hWaitCur), OCR_HAND);
SetSystemCursor(CopyCursor(hWaitCur), OCR_HELP);
SetSystemCursor(CopyCursor(hWaitCur), OCR_IBEAM);
SetSystemCursor(CopyCursor(hWaitCur), OCR_NO);
SetSystemCursor(CopyCursor(hWaitCur), OCR_WAIT);

10-06 08:44