Show mouse cursor using .net if mouse cursor is invisible

Arvind Sonar 0 Reputation points
2023-06-02T07:45:30.59+00:00

Hi,

I have touch screen windows pc and no physical keyboard and mouse is not connected.

I have developed virtual mouse to operate from remote PC.

When user starts operating from touch screen, mouse gets disappeared.

I don't want to connect physical mouse.

I am able to get the status of mouse using following code.

        [DllImport("user32.dll")]
        static extern bool GetCursorInfo(ref CursorInfoStruct pci);

        public static bool IsVisible()
        {
            CursorInfoStruct pci = new CursorInfoStruct();
            pci.cbSize = Marshal.SizeOf(typeof(CursorInfoStruct));
            GetCursorInfo(ref pci);
            // const Int32 hidden = 0x00;
            const Int32 showing = 0x01;
            // const Int32 suppressed = 0x02;
            bool isVisible = ((pci.flags & showing) != 0);
            return isVisible;
        }

How can I make cursor visible through applicaiton?

Windows for business Windows Client for IT Pros Devices and deployment Other
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.