I a system, where there is a number of USB-com adapters I need to open
COM10 and COM15 - but there seems to be a problem with that using the
common com drivers I have.
Windows Hyperterminal can do it easily, but not from Delphi
Can anyone tell me why delphi cannot open any higher that COM9 (<- one
digit number)
WBR
Sonnich
I use this API call to open a port:
hComm::=CreateFile('COM10', GENERIC_READ or GENERIC_WRITE, 0, NIL,
OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0);
it returned hComm=INVALID_HANDLE_VALUE.
Must be a problem with this API call for COM>9.
There is one thing people keep leaving out..
and that is the ":"
'COM10:';
etc///
also...
the last time I knew, you could only open the port in
one directly per handle.
you are doing it in both.
it's also possible the OS didn't map it in the registry which it should
have..
using the "\\\.\\xxxx" may be required but I don't see why.
I'm sorry, I didn't understand "you could only open the port in one directly
per handle. you are doing it in both"
I actually have more than one port open at a time, the actual code is:
StrFmt(text, 'COM%d', [Port]);
hComm[Port]:=CreateFile(text, GENERIC_READ or GENERIC_WRITE, 0, NIL,
OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0);
Kevin
help 'com10'
-> Specifying Serial Ports Larger than COM9
then browse help from createfile to communications
http://support.microsoft.com/kb/115831/en-us
\\.\com10 \\\\.\\com10 in C
0 to 9 are legacy ,com10 will fail or open com0
there are other formats for opening device control but \\.\ should work
The house of cards may have different cards fallen out , rearranged and
replaced on different machines. :-)
So,
StrFmt(text, '\\.\COM%d', [Port]);
hComm[Port]:=CreateFile(text, GENERIC_READ or GENERIC_WRITE, 0, NIL,
OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0);
should work for all port numbers. I'll try it !