EnumSerialPorts v1.0
Welcome to EnumSerialPorts v1.0, A simple
MFC function to enumerate the serial ports installed on your machine.
Features
- Simple C style function interface.
- The code works on both Windows 95/98 and NT.
The whole problem is that there is no standard Win32 API call which allows serial port
enumeration. The approach that this code uses is calling CreateFile directly. If the port
cannot be opened, the code examines the error code to see if it was accessed denied error
in which case it knows that the port exists even though it could not open the port.
- The code is fully Unicode compliant and
include Unicode built options in the workspace file.
Usage
- To use the function in your code simply
include enumser.cpp in your project and #include enumser.h in which ever of your modules
needs to make calls to the function.
- Your code will need to include MFC either statically or dynamically.
- To see the class in action, have a look at the main function in the
module "main.cpp".
History
V1.0 (3 November 1998)
API
Reference
EnumerateSerialPorts
void ::EnumerateSerialPorts(CUIntArray& ports);
Parameters
ports Upon return this array will contain the port numbers
of all the serial ports installed on the computer
CONTACTING
THE AUTHOR
PJ Naughter
Email: pjn@indigo.ie
Web: http://indigo.ie/~pjn
3 November 1998