Originally is a USB extension to a USB 4, and then the USB to the serial port connection, although the Device Manager can be found with sscom can also be found, but with the API is not open, and finally the USB to plug in the computer on a USB on it!
1#include <windows.h>2#include <stdio.h>3#include <stdlib.h>4 5 BOOLOpenport (Char*portname)//Open the serial port6 {7 HANDLE Hcomm;8Hcomm = CreateFile (PortName,//Serial Number9Generic_read | Generic_write,//allow read and writeTen 0,//the communication device must be opened exclusively One 0,//No security attributes AOpen_existing,//communication device already exists -File_flag_overlapped,//asynchronous I/O - 0);//communication devices cannot be opened with a template the if(Hcomm = =Invalid_handle_value) - { - CloseHandle (hcomm); - returnFALSE; + } - Else + return true; A } at - voidMain () - { - BOOLOpen; -Open=openport ("COM4"); - if(Open) inprintf"Open Comport Success"); -System"Pause") ; to}