Parallel Port Address/Driver :-?

win95/msvc++: i need to know the lpt address (for example 378), ppl tell me i need to write a parallel port driver, i dont have a clue how to do this, is there another way to know the address, if now plz give me full detail how to write this driver.
10x
talspAsked:
Who is Participating?
 
jstolanConnect With a Mentor Commented:
You need to use the CreateFile function to open a handle to the parallel port.  You can then use the handle to write (and read for bidirectional ports) just like any other file I/O.

Here is a quote from part of the CrateFile help topic:

"The CreateFile function can create a handle to a communications resource, such as the serial port COM1. For communications resources, the dwCreationDistribution parameter must be OPEN_EXISTING, and the hTemplate parameter must be NULL. Read, write, or read-write access can be specified, and the handle can be opened for overlapped I/O. For more information about communications, see Communications"

Note that although it specifically mentions COM1, this also applies to LPT1 etc.  This is a tricky topic.  Good luck.

0
 
jhanceCommented:
Knowing the address will not help you as you cannot directly access an IO port in a Win32 program.. The IO space is protected and can only be accessed in a VxD or regular device driver.
0
 
talspAuthor Commented:
so how can i access vxd or device driver?
0
All Courses

From novice to tech pro — start learning today.