Hey just tries google on this you gets lots
one of method i used for opening SerialPort.
Don't forgot try catch block.
try {
CSerialPort port;
port.Open(1, 1200, CSerialPort::NoParity, 8,
CSerialPort::OneStopBit,
CSerialPort::XonXoffFlowControl);
char sBuf[] = "This should appear on the serial port";
port.Write(sBuf, strlen(sBuf));
port.Flush();
port.Close();
}
catch (CSerialException* pEx)
{
TRACE(_T("Handle Exception, Message:%s\n"),
pEx->GetErrorMessage());
pEx->Delete();
}