0

Where i can get the instance id of Com_port? I tried in device manager but those are not working

string instance_Path = @"VID_12D1&PID_140C&MI_02";
DeviceHelper.SetDeviceEnabled(mouseGuid, instance_Path, true);
5
  • What is "mouseGuid"? Are the process working with administrator rights? Commented Oct 4, 2015 at 9:40
  • yeah i logged with admin login only Commented Oct 4, 2015 at 10:06
  • I mean, you must run a process with elevated privileges in order to enable/disable devices with it (unless you are using windows xp). Commented Oct 4, 2015 at 10:24
  • can you please help to run process with privilege Commented Oct 4, 2015 at 12:32
  • What do you mean "are not working"? You get UnauthorizedAccessException if the problem is the access right. Could it be you're just specifying a wrong GUID? Commented Oct 5, 2015 at 6:05

1 Answer 1

1

This question is virtually a duplicate - Win32 API function to programmatically enable/disable device

"mouseGuid" might be pasted from there. I suppose you're specifying a wrong GUID for the COM port. You can see the correct one in the Device Manager, Details tab -> choose "Class Guid" from the dropdown menu.

Having troubles messing with WinAPI, you can use a library (e.g. Hardware Helper) or an external tool (DevCon).

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.