I made a program to identify whether the mouse cursor is Hand
or not. I'm using an event that identifies the global cursor, so even out of Form
it is able to identify. The problem is that in function:
private static bool Cursor()
{
var h = Cursors.Hand.Handle;
CURSORINFO pci;
pci.cbSize = Marshal.SizeOf(typeof(CURSORINFO));
GetCursorInfo(out pci);
return pci.hCursor == h;
}
When I test it on a button by placing the mouse over some link or something else that makes the cursor Hand
, it does not identify! But if I change and put Cursors.Default.Handle
it always identifies whether the cursor is Default or not.
What am I doing wrong? How to identify whether the cursor is Hand
or not?