Click here to Skip to main content
11,927,378 members (51,235 online)
Rate this:
Please Sign up or sign in to vote.
See more: C++
Hi Friends,
I am new for C++.Now i am working in a COM Port Project. I have a DLL File for accessing COM Port data(sending and Receiving).Now,I access COM1 to COM9.But i can't access above COM10.Why?how can i solve this problem?please tell me.
Thanks and Regards
Posted 18-Apr-11 22:14pm
SAKryukov 19-Apr-11 3:19am
The nature of limitation is more or less clear, but the problem looks a bit tricky. My 5 for the Question.

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

CreateFile() can be used to access serial ports using "COM1" through "COM9" for the name of the file; however, the message INVALID_HANDLE_VALUE is returned if you use "COM10" or greater.

For ports > 9, the correct way to specify the serial port in a call to CreateFile() is as follows:
   "\\\\.\\COM10",     // address of name of the communications device
   fdwAccess,          // access (read-write) mode
   0,                  // share mode
   NULL,               // address of security descriptor
   OPEN_EXISTING,      // how to create
   0,                  // file attributes
   NULL);              // handle of file with attributes to copy

Also, be sure the COM device you are trying to access is actually installed. You can use the freeware program SIW to verify this:[^]
Peter_in_2780 19-Apr-11 3:50am
I can't find it right now, but there was a previous thread on this topic where I pointed out that under Vista, for some #$%^ M$ reason, you need "run as admin" to access \\.\COMxx XP works fine, don't know about Weven.
SAKryukov 19-Apr-11 11:41am
My 5.
naraayanan 28-Apr-11 6:57am
Thanks my friend

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web03 | 2.8.151126.1 | Last Updated 19 Apr 2011
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100