Click here to Skip to main content
15,881,803 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello,
I am working on a project, and i got stuck at a point i want to check weather my pointing device(mouse) is working or not.
I want to check it programmatically .
Thank You in Advance. :)
Posted
Updated 25-Jan-12 10:42am
v3

1 solution

You can't, in any real way.
You can detect that there is a pointing device:
C#
SelectQuery selectQuery = new SelectQuery("Win32_PointingDevice");
ManagementObjectSearcher searcher = new ManagementObjectSearcher(selectQuery);

foreach (ManagementObject pointer in searcher.Get())
    {
    Console.WriteLine(pointer.ToString());
    }

But you can't tell if it works until the user moves it, and / or clicks the buttons.
 
Share this answer
 
Comments
Lakamraju Raghuram 25-Jan-12 12:13pm    
For detecting another way is the use "System.Windows.Forms.SystemInformation"
Check this here: http://msdn.microsoft.com/en-us/library/system.windows.forms.systeminformation.mousepresent.aspx

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900