CParallelPort
v1.14
Welcome to CParallelPort, a simple MFC class to give you low
level control of parallel ports on Windows 95, 98, ME, NT, 2000, XP and 2003.
The code is based on the ideas and code from the book "Parallel Port
Complete" which I would recommend you read, if you want to learn more about
parallel ports and their programmatic use. The class allows you to read and
write values to the port using low level port IO while at the same time making
sure that the code does not cause problems for other apps using the parallel
ports using normal Win32 calls. As of v1.1, the code also now works on NT /
2000.
Features
- Simple and clean C++ interface.
- All the code is UNICODE compliant and build configurations are provided
for this.
- The code works on NT, 2000, XP and 2003 just as well as on 95,98 & ME.
- The code can be used in a console application or GUI app without
problems.
- The code implements a simple file transfer class which the sample app
uses to implement a simple client / server app to transfer files from PC to
PC via "LPT1". Testing on my lowly Pentium 233 laptop yielding a consistent
transfer rate of 40 - 50 KB / S using Nibble mode on an SPP port.
Usage
- To use the class in your code simply include parallelport.cpp in your
project and #include parallelport.h in which ever of your modules needs to
make calls to the classes.
- Your code will need to include MFC either statically or dynamically.
- You may want to add afxtempl.h to your pre compiled header to improve
compilation speed.
- To see the class in action, have a look at the code in _tmain in the
module "main.cpp".
- If you are going to be using the CParallelPort code on Windows NT, 2000,
XP or 2003, then you will need to download and install the freeware
DriverLINX PortIO driver. As a convenience, you can download a self
extracting installer from the author's web site at
http://www.naughter.com/download/port95nt.exe. Alternatively you can
download it from the DriverLINX web site at
www.driverlinx.com.
History
V1.0 (5 April 1999)
V1.1 (21 July 2000)
- Now works on NT / Windows 2000 thanks to DriverLINX Port I/O Driver
- Made all typedefs and enums local to the appropiate class rather than
polluting the global namespace. You will get compiler errors if you have
code using v1.0 of the class. It is a simple change to fix this, just to use
the scope operator "CParallelPort::" before all the enums you used.
V1.11 (12 April 2003)
- Updated copyright details.
- Updated documentation to refer to new DriverLinx web site.
- Code now issues compile time message if conio or afxpriv are not in your
PCH.
V1.12 (11 June 2003)
- Reviewed all places where exceptions are throw and the details which are
logged in TRACE statements.
V1.13 (24 September 2004)
- Fixed a problem in the sample app where there were two instances of the
CParallelPort which was causing problems with CArray upon startup.
- Fixed problems with the sample app when compiled for Unicode. The Linker
entry point symbol is now "wmainCRTStartup".
V1.14 (9 July 2006)
- Updated copyright details.
- Renamed AfxThrowParallelException to ThrowParallelException and made it
a member of CParallelPort.
- CParallelPort is no longer derived from CObject as it was not really
required
- Optimized CParallelPortSettings constructor code
- Optimized CParallelException constructor code
- Removed CParallelException destructor
- Optimized CParallelPort constructor code
- Renamed CParallelException class to CParallelPortException
- Removed CParallelPortFileTransfer destructor as it was not required.
- Code now uses newer C++ style casts instead of C style casts.
- Updated the documentation to use the same style as the web site
- Updated code to clean compile on VC 2005
API Reference
The API consists of the 3 classes CParallelException, CParallelPortSettings
and CParallelPort, their public methods and variables as defined in
ParallelPort.h
Planned Enhancements
- If you have any other suggested improvements, please let me know so that
I can incorporate them into the next release.
Contacting the Author
PJ Naughter
Email: pjna@naughter.com
Web: http://www.naughter.com
9 July 2006