KH
Junior Member level 1
Hi,
Recently I upgrade from VC 6 to VC2005, and ported one program over. This program basically open the COM Port and send some binary data through the port.
The program did not give any compilation error or warnings on VC2005, but it always return an invalid handle. Below is part of the codes
char ComPort[5]="COM1";
ComHandle = ::CreateFile( LPCTSTR(ComPort), GENERIC_WRITE|GENERIC_READ,
0, NULL, OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL , NULL
);
These codes is working fine in VC6, but not VC2005, which part is wrong ?
Recently I upgrade from VC 6 to VC2005, and ported one program over. This program basically open the COM Port and send some binary data through the port.
The program did not give any compilation error or warnings on VC2005, but it always return an invalid handle. Below is part of the codes
char ComPort[5]="COM1";
ComHandle = ::CreateFile( LPCTSTR(ComPort), GENERIC_WRITE|GENERIC_READ,
0, NULL, OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL , NULL
);
These codes is working fine in VC6, but not VC2005, which part is wrong ?