I've been trying to do so and couldn't make it, this is what I got to :
[DllImport("user32.dll")]
static extern bool SetSystemCursor(IntPtr hcur, uint id);
[DllImport("user32.dll", EntryPoint = "GetCursorInfo")]
public static extern bool GetCursorInfo(out CURSORINFO pci);
[DllImport("user32.dll", EntryPoint = "CopyIcon")]
public static extern IntPtr CopyIcon(IntPtr hIcon);
[StructLayout(LayoutKind.Sequential)]
public struct CURSORINFO
{
public Int32 cbSize; // Specifies the size, in bytes, of the structure.
public Int32 flags; // Specifies the cursor state. This parameter can be one of the following values:
public IntPtr hCursor; // Handle to the cursor.
public POINT ptScreenPos; // A POINT structure that receives the screen coordinates of the cursor.
}
public void etc()
{
IntPtr hwndic = new IntPtr();
CURSORINFO curin = new CURSORINFO();
curin.cbSize = Marshal.SizeOf(curin);
if (GetCursorInfo(out curin))
{
if (curin.flags == CURSOR_SHOWING)
{
hwndic = CopyIcon(curin.hCursor);
SetSystemCursor(hwndic, OCR_NORMAL);
}
}
}
The problem is that the copied icon sometimes is different than the default mouse icon, if it catches it on waiting position for example then it might give me the mouse waiting icon.
I wish to get the default cursor icon (the icon at idle) of the running system, how can I do so?
Thanks in advance.