How to hide the cursor in windows when dragging and dropping (possibly in python, or another language)
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.
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.
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.
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.
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.
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.
Many thanks in advance!
Windows SDK:
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 ;
精彩评论