The code to read the serial port is covered on the Internet, but they are almost entirely, the first person writes is the hero, the other is not. This code is similar to the following: Variant Variant_inp; ColesafeArray Safearray_inp; Long Len, K; Byte RxData [2048]; // Set Byte array an 8-bit integerthat is not sign.cstring startemp; if (m_ctrlcomm.getCommEvent () == 2) // The event value is 2 indicates that there is a character {below in the receiving buffer you can join the processing code variant_inp = m_ctrlcomm.getinput (); // read buffer SafeArray_inp = variant_inp; // variant type variable conversion For the COLESAFEARRAY type variable len = SafeArray_inp.getonedimsize (); // Get valid data length for (k = 0; k