I want to open comport which is higher than 9 in VC++ code. The following code can open comport which is higher than 9. But, the result I am getting in combo box is "\.\COM10". I don't want "\.\" before COM name in combo box. Please help me to resolve this issue. My code :
CString str;
int i;
for(i=1;i<30;i++)
{
str.Format("\\\\.\\COM%d",i);
ptrLC->comPort.CloseCommPort();
if(ptrLC->comPort.OpenCommPort(str))
{
m_cCommPort.AddString(str);
ptrLC->comPort.CloseCommPort();
}
}
Thank you for your contribution...The above issue is resolved. I did changes in above code which helps me to open comport higher than 9. And also combo box Drop Down list does not contain \.\ before COM name.
Corrected code: