Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Opening COM10 and COM15

373 views
Skip to first unread message

jodleren

unread,
Jul 7, 2008, 4:42:06 AM7/7/08
to
Hi!

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

Kevin Urben

unread,
Jul 7, 2008, 5:04:30 PM7/7/08
to
What a coincidence ! I had that same problem today !

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.

Jamie

unread,
Jul 7, 2008, 5:18:01 PM7/7/08
to
Please show the code you're using to open the ports.

http://webpages.charter.net/jamie_5"

Jamie

unread,
Jul 7, 2008, 5:55:36 PM7/7/08
to
Kevin Urben wrote:

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.


http://webpages.charter.net/jamie_5"

Kevin Urben

unread,
Jul 8, 2008, 6:07:36 AM7/8/08
to
Thanks for pointing out the missing ":" - but the call has worked fine for
ports <10 without the ":" - I will check if it fixes the problem when I get
the chance.

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


Terry Russell

unread,
Jul 8, 2008, 10:50:03 AM7/8/08
to

"Kevin Urben" <m...@nospam.co.uk> wrote in message
news:02c94b18$0$15071$c3e...@news.astraweb.com...

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. :-)


Kevin Urben

unread,
Jul 8, 2008, 6:53:43 PM7/8/08
to
Many thanks for that link !

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 !


0 new messages