opening more than one serial port
-
Hi, i have a function, which should open a serial Port. Now i wan't to open more than one port with that function: HANDLE port1, port2; PortInitialize(portname1, port1); PortInitialize(portname2, port2); with that function: BOOL CPort::PortInitialize(LPTSTR lpszPortName, HANDLE hCommPort) { DWORD dwError; DCB PortDCB; COMMTIMEOUTS CommTimeouts; // Open the serial port. hCommPort = CreateFile (lpszPortName, GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, NULL); ....... } But unfortunately, the second port2 can't be opened. I think there is a conflict with the handles, because there should be a pointer on the address of the handle, but that's even not working. Greetings, Frank _____ easySMS for pocket PC _____ www.Siedler-Net.de/WinCE/easySMS/
-
Hi, i have a function, which should open a serial Port. Now i wan't to open more than one port with that function: HANDLE port1, port2; PortInitialize(portname1, port1); PortInitialize(portname2, port2); with that function: BOOL CPort::PortInitialize(LPTSTR lpszPortName, HANDLE hCommPort) { DWORD dwError; DCB PortDCB; COMMTIMEOUTS CommTimeouts; // Open the serial port. hCommPort = CreateFile (lpszPortName, GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, NULL); ....... } But unfortunately, the second port2 can't be opened. I think there is a conflict with the handles, because there should be a pointer on the address of the handle, but that's even not working. Greetings, Frank _____ easySMS for pocket PC _____ www.Siedler-Net.de/WinCE/easySMS/
After
CreateFile
check this:if(ERROR_FILE_NOT_FOUND == hCommPort)
{
// The COMM port does not exist.
} -
After
CreateFile
check this:if(ERROR_FILE_NOT_FOUND == hCommPort)
{
// The COMM port does not exist.
}Yes, but that port does exist! _____ easySMS for pocket PC _____ www.Siedler-Net.de/WinCE/easySMS/
-
Hi, i have a function, which should open a serial Port. Now i wan't to open more than one port with that function: HANDLE port1, port2; PortInitialize(portname1, port1); PortInitialize(portname2, port2); with that function: BOOL CPort::PortInitialize(LPTSTR lpszPortName, HANDLE hCommPort) { DWORD dwError; DCB PortDCB; COMMTIMEOUTS CommTimeouts; // Open the serial port. hCommPort = CreateFile (lpszPortName, GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, NULL); ....... } But unfortunately, the second port2 can't be opened. I think there is a conflict with the handles, because there should be a pointer on the address of the handle, but that's even not working. Greetings, Frank _____ easySMS for pocket PC _____ www.Siedler-Net.de/WinCE/easySMS/
Two questions: Frank S. wrote: HANDLE hCommPort Shouldn't this be
HANDLE& hCommPort
? Are you correctly spelling the COM ports likeCOM1:
andCOM2:
? You are using the same code forCreateFile
as I did. The only difference is that I opened only one port... Other than these, I have no immediate clues. :(