如何在Windows中隐藏光标,拖放(可能在python或其他语言) [英] How to hide the cursor in windows when dragging and dropping (possibly in python, or another language)

查看:657
本文介绍了如何在Windows中隐藏光标,拖放(可能在python或其他语言)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

经过几个小时的搜索google,几乎没有运气,我想知道是否有人知道如何隐藏光标,或者在Windows中拖放时设置自定义光标(可以为空白)。

After hours of searching google, with little luck, I'm wondering if anybody knows how to either hide the cursor, or set a custom cursor (which could be made blank) in Windows when dragging and dropping.

我正在编写一个程序,使用openGL绘制自己的鼠标,通常鼠标隐藏的很好,但是当我将文件拖动到程序的窗口时,并且不会隐藏。

I'm writing a program which draws its own mouse using openGL, and normally the mouse hides just fine, but when I drag files onto the program's window, the windows cursor shows the drag-and-drop square and will not hide. ShowCursor(False) and SetCursor(None) (in python) are inconsistent for hiding the cursor.

理想情况下,如果有人知道如何使用pywin32在Python中做到这一点,那就是使用pywin32这将是理想的,因为这是我的项目使用的语言,但如果我必须用另一种语言编写代码。

Ideally, if anybody knew how to do this in Python using pywin32, that would be ideal, as that's the language my project is using, but if I have to code this up in another language I will.

或者,如果有人知道ShowCursor SetCursor将保证隐藏光标,无论这是与窗口焦点还是相关的东西,这也将是有帮助的。

Alternately, if anybody knows when ShowCursor and SetCursor will guarantee to hide the cursor, whether this has to do with window focus or something related, that would also be helpful.

我发现这个网页: http://msdn.microsoft.com/en -us / library / system.windows.forms.control.dodragdrop.aspx#Y1354
我无法获得C ++代码进行编译,当我使用C#和VB版本时,我得到了异常。我已将光标从C:\Windows \Cursors复制到具有可执行文件的目录为3dwarro.cur和3dwno.cur。

I've found this page: http://msdn.microsoft.com/en-us/library/system.windows.forms.control.dodragdrop.aspx#Y1354 I cannot get the C++ code to compile, and I get exceptions when I use the C# and VB versions. I've copied cursors from C:\Windows\Cursors to the directory with the executable as 3dwarro.cur and 3dwno.cur. When I comment out the try clauses, when it tries to load the cursors it says they are corrupt.

我还发现这个网页: http://www.rockhoppertech.com/java-drag-and-drop-faq.html < a>。它说,将DragContext的光标设置为null,然后设置为dragOver中的光标。页面是Java的,我不知道该怎么做。

I've also found this page: http://www.rockhoppertech.com/java-drag-and-drop-faq.html. It says to set the DragContext's cursor to null and then to your cursor in dragOver. The page is in Java, and I don't know how to do what it is saying.

非常感谢!

推荐答案

Windows SDK:

Windows SDK:


ShowCursor:此函数设置
内部显示计数器,
决定光标是否应该显示

ShowCursor: This function sets an internal display counter that determines whether the cursor should be displayed. The cursor is displayed only if the display count is greater than or equal to 0.

因此,如果显示计数大于
,光标将显示
。应该尝试相当于:

So you should try the equivalent of:

while ShowCursor(False) >= 0 do ;

这篇关于如何在Windows中隐藏光标,拖放(可能在python或其他语言)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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