0
votes

I am looking for way to find and enable/disable system device.I am referring these link http://code.msdn.microsoft.com/windowshardware/DevCon-Sample-4e95d71c#content.I am able to run devcon command on console but I want to run programatically in c#.

I am refer these link Win32 API function to programmatically enable/disable device . when I ran these code posted by justin, In SetDeviceEnabled function . I got -1 value in index variable.I changed mouseGuid & instancePath according my system configuration. I am using visual studio 2013 RC. can you help me in this regard.

1

1 Answers

1
votes

These is the solution of my Que.

      try
        {
            var psi = new ProcessStartInfo(@"C:\Program Files (x86)\Windows Kits\8.1\Tools\x64\devcon.exe");
            {
                psi.UseShellExecute = false;
            };

            psi.Arguments = @"disable *mou";
            Process pDisable = Process.Start(psi);

            psi.Arguments = @"enable *mou";
            Process pEnable = Process.Start(psi);

            Console.ReadLine();
        }
        catch(Exception e)
        {
            string message = e.Message;
        }