With version 1.4.0.0 of com0com, the HyperTerminal test succeeds, but I get a failure when trying to open the port with CreateFile():
m_hComm = CreateFile("CNCA0", GENERIC_READ | GENERIC_WRITE, 0, 0, OPEN_EXISTING, FILE_FLAG_OVERLAPPED, 0);
GetLastError() returns ERROR_FILE_NOT_FOUND.
Should I be using a different device name (other than "CNCA0")? I tried a few other variations.
Thanks
Excellent question, Jonathan ;>
With device names of this type, you need to prefix them with \\.\, as in:
\\.\CNCA0
Hello !
I tried to use CreateFile as described in the ReadMe & here, but without being successful ...
HANDLE h = CreateFile( (LPCWSTR)"\\\\.\\CNCA0", GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_SYSTEM, NULL );
The test with the Hyperterminal is ok. I don't have so much knowledges about COM ports, and my google searches didn't get me any further ...
So ... Any tip to get a step ahead would be very welcome ;)
J
In case another one would forget about UNICODE / ANSI stuff ...
The answer is contained in the previous line.
> HANDLE h = CreateFile( (LPCWSTR)"\\\\.\\CNCA0",
Try to replace (LPCWSTR) by TEXT():
TEXT("\\\\.\\CNCA0"),
> FILE_ATTRIBUTE_SYSTEM,
Why is it?
Log in to post a comment.
With version 1.4.0.0 of com0com, the HyperTerminal test succeeds, but I get a failure when trying to open the port with CreateFile():
m_hComm = CreateFile("CNCA0",
GENERIC_READ | GENERIC_WRITE,
0,
0,
OPEN_EXISTING,
FILE_FLAG_OVERLAPPED,
0);
GetLastError() returns ERROR_FILE_NOT_FOUND.
Should I be using a different device name (other than "CNCA0")? I tried a few other variations.
Thanks
Excellent question, Jonathan ;>
With device names of this type, you need to prefix them with \\.\, as in:
\\.\CNCA0
Hello !
I tried to use CreateFile as described in the ReadMe & here, but without being successful ...
HANDLE h = CreateFile( (LPCWSTR)"\\\\.\\CNCA0",
GENERIC_READ | GENERIC_WRITE,
0,
NULL,
OPEN_EXISTING,
FILE_ATTRIBUTE_SYSTEM,
NULL
);
The test with the Hyperterminal is ok. I don't have so much knowledges about COM ports, and my google searches didn't get me any further ...
So ... Any tip to get a step ahead would be very welcome ;)
Thanks
J
In case another one would forget about UNICODE / ANSI stuff ...
The answer is contained in the previous line.
> HANDLE h = CreateFile( (LPCWSTR)"\\\\.\\CNCA0",
Try to replace (LPCWSTR) by TEXT():
TEXT("\\\\.\\CNCA0"),
> FILE_ATTRIBUTE_SYSTEM,
Why is it?