المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : Remap a COM port programmatically



C# Programming
03-10-2010, 03:01 AM
Hi,

I need to change my COM1 port to COM5. I can easily do it by opening the port advanced properties in the Device Manager and changing it from COM1 to COM5.
However, I searched google all over for a solution to do it from my code, and didn't find anything.
I can read the port settings using the SerialPort class or WMI, for example, I can read the DeviceID property of the Win32_SerialPort class. But I can't write to this property, it's read-only. Is there any other way to accomplish the same thing?