Working with serial and parallel ports in C++ Builder.

By: Christopher Moeller

Abstract: Unlike DOS, Win32 discourages direct hardware access.

Question:

How can I gain direct access to serial and parallel ports in C++ Builder?


Answer:

Direct hardware access in 32-bit Windows is generally not allowed. While it can be done in the Win9x OS by using inline assembly, this is generally discouraged as this technique is not supported under WinNT.
When doing Serial and Com port communications, there are several options available. You can use a third party VCL component, or use the Win32 API CreateFile and the Win32 communications functions. For more information on this technique, refer to the Using the communications functions help topic in the Microsoft WinSDK help files.

The following program features and language elements are either no longer supported or no longer used in this release of C++Builder.

RTL elements:

farfree
faralloc
farmalloc
farheapcheck
farrealloc
inp
inpw
outp
outpw
inport
inportb
outport
outportb


Server Response from: ETNASC03