I\'m using ReadFile() on Windows to read data from a serial port. This code was working fine at one point in time, but it\'s now failing and I\'m trying to trac
ReadFile()
The constructor of QMessageBox may be doing something that clears `GetLastError'. Try this:
if (!ReadFile(hGpsUart, buf, 160, &bytes_read, NULL)) { int LastError = GetLastError() ; QMessageBox msg; msg.setText(QString("Error %1 reading from GPS UART!").arg(LastError)); msg.exec(); }