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);
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);
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).