I just want to post here the conclution to this old thread, I can't
reply to the thread any more, I guess it is no longer active...
The problem was related to the port timeout settings, this is the code
that fixed it, it is placed after the ::SetCommState() function:
//
// Initialize timeout values
//
COMMTIMEOUTS commTimeouts;
BOOL bRetTimeouts = FALSE;
/// \ Set the timeouts for the CommPort
/// \ These values were retrieved by the setting of the Comm through
hyperTerminal
commTimeouts.ReadIntervalTimeout = 10;
commTimeouts.ReadTotalTimeoutConstant = 0;
commTimeouts.ReadTotalTimeoutMultiplier = 0;
commTimeouts.WriteTotalTimeoutMultiplier = 0;
commTimeouts.WriteTotalTimeoutConstant = 5000;
bRetTimeouts = SetCommTimeouts(m_hFile, &commTimeouts);
ASSERT(bRetTimeouts == TRUE);