Trying to open COM1 in XP using CreateFile and I keep getting INVALID_HANDLE_ VALUE.
here is the code I am using:
//main
.............
.....
....
..
.
.
..
...
......
.............
I used GetLastError to get more details. and I received error # 123?
I have searched Google and looked at MSDN and could not info to help me solve the problem. There are dozens of articles explaining CreateFile and how one should use it, but no real substance. I have checked my device manager and my COM1 is active with no conflicts. I have checked my registry and have confirmed my COM1 in memory.
Please advise.
Thanks,
Sevak
here is the code I am using:
//main
.............
.....
....
..
.
Code:
HANDLE serialhCom = CreateFile("COM1", GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, FILE_FLAG_OVERLAPPED, NULL); if (serialhCom != INVALID_HANDLE_VALUE) { SetupComm(serialhCom, inLen, outLen); serialSetTimeouts(serialhCom, MAXDWORD, 0, 0, 0, 0); } else { printf ("Could not open COM1\n"); }
..
...
......
.............
I used GetLastError to get more details. and I received error # 123?
I have searched Google and looked at MSDN and could not info to help me solve the problem. There are dozens of articles explaining CreateFile and how one should use it, but no real substance. I have checked my device manager and my COM1 is active with no conflicts. I have checked my registry and have confirmed my COM1 in memory.
Please advise.
Thanks,
Sevak
Comment