Sign in

- Cart 0

Cart 0


- windows 10
- microsoft support phone number
- windows 7
- outlook
- microsoft
- microsoft support
- windows 8.1
- windows update
- fix printer problems
- office 365

Virtual Support Agent

### Virtual Support Agent

## Your browser is out-of-date

You need to update your browser to use the site.

Update to the latest version of Internet Explorer

CV: RIMyHOLCyAjV5JL5.0

# HOWTO: Specify Serial Ports Larger than COM9

-  Email
-  Print

This article was previously published under Q115831

##### SUMMARY

CreateFile() can be used to get a handle to a serial port. The "Win32 Programmer's Reference" entry for "CreateFile()" mentions that the share mode must be 0, the create parameter must be OPEN_EXISTING, and the template must be NULL.
CreateFile() is successful when you use "COM1" through "COM9" for the name of the file; however, the message
INVALID_HANDLE_VALUE
is returned if you use "COM10" or greater.
If the name of the port is \\.\COM10, 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
       );

NOTES: This syntax also works for ports COM1 through COM9. Certain boards will let you choose the port names yourself. This syntax works for those names as well.
3.10 3.50
Properties

Article ID: 115831 - Last Review: 03/01/2005 15:35:00 - Revision: 3.3

Applies to

- Microsoft Win32 Application Programming Interface

Keywords:

- kbhowto kbapi kbcommport kbkernbase kbserial KB115831

##### Feedback

Was this information helpful?
Yes
No
Somewhat
Tell us what we can do to improve the article
Thanks! Your feedback will help us improve the support experience. For more help, try searching for what you need at the top of the page.