重置自定义系统光标正常 [英] Reset custom system cursor to normal

查看:137
本文介绍了重置自定义系统光标正常的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我改变与SetSystemCursor系统光标,但是当我尝试重置系统光标nornal与DestroyCursor没有任何反应!

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

任何想法?

谢谢!

推荐答案

由于记录的SetSystemCursor()函数已经破坏了通过光标,再次摧毁它不会有任何效果。

As documented, the SetSystemCursor() function already destroys the passed cursor so destroying it again isn't going to have any effect.

您需要存储旧光标的副本,这样你就可以在以后恢复它:

You'll need to store a copy of the old cursor so 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);

和这样的恢复:

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

请注意你的事业时,你的程序没有恢复光标终止相当大的痛苦。由于经历了由我测试这个code。更改系统光标是非常不友好的,因为它有可在桌面上运行的所有其他程序的全球影响。

Note the considerable pain you cause when your program terminates without restoring the cursor. As experienced by me testing this code. Changing system cursors is quite unfriendly since it has a global effect on all other programs that run on the desktop.

这篇关于重置自定义系统光标正常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆