Click here to Skip to main content
Rate this: bad
good
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
Naraayanan.
Posted 18-Apr-11 22:14pm
Comments
SAKryukov at 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.
--SA

1 solution

Rate this: bad
good
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:
   CreateFile(
      "\\\\.\\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: http://www.gtopala.com/[^]
  Permalink  
v4
Comments
Peter_in_2780 at 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 at 19-Apr-11 11:41am
   
My 5.
--SA
naraayanan at 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
0 Mathew Soji 334
1 Maciej Los 295
2 BillWoodruff 290
3 Afzaal Ahmad Zeeshan 257
4 DamithSL 225
0 OriginalGriff 6,369
1 Sergey Alexandrovich Kryukov 5,973
2 DamithSL 5,183
3 Manas Bhardwaj 4,673
4 Maciej Los 4,045


Advertise | Privacy | Mobile
Web01 | 2.8.1411019.1 | Last Updated 19 Apr 2011
Copyright © CodeProject, 1999-2014
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