views:

1094

answers:

3

How do I get the current mouse cursor type? In Windows.

I mean - if it's a hourglass, an arrow, etc? I need it even if the mouse is ouside of my application or even if my program is windlowless.

In C#, Delphi or pure winapi, nevermind...

Thank you very much in advance!!

+4  A: 

Use (in Delphi)

Screen.MouseCursor.

For the current mouse cursor.

General Win32 (user32) gives:

function GetCursor: HCURSOR; stdcall;

This should be available for other win32 languages.

Gamecat
That's not right. As I learned in another question, GetCursor won't work for other programs' cursors anymore: http://stackoverflow.com/questions/358527/how-to-tell-if-mouse-pointer-icon-changed
Rob Kennedy
A: 

EDIT: In Delphi

In most visual objects you can use the Cursor property, otherwise use the Screen.Cursor propery. Setting it back to crDefault canceles your change to whatever it was set before.

Drejc
That doesn't give you the cursor outside your program.
Rob Kennedy
+3  A: 

To get the information on global cursor, use GetCursorInfo.

gabr