VB.Net Reading Parallel Port Under Windows XP/2000

I want to write an application in VB.Net that will allow me to read data from a parallel printer port.

1. How can I do this to specifically work under Windows XP? How do I program this in VB.Net to read data?

2. Is there a way to do this that will work platform independent - i.e. any platform that will work with my VB.Net program will be able to use my program to read from the parallel port.
mswatAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

rkosaiCommented:
It is not possible to access the parallel port directly under Windows 2000 or XP.  Under the 9x codebase, you are able to read and write from LPT1 at the memory address 0x378 using the inportb() and outportb() functions in C++.  However, because of the "protected" memory of the NT code base it is impossible to access the parallel port under 2k or XP without using a driver.  You can download several free parallel port drivers; I have listed a few links below.

http://www.paraport.net/
http://www.internals.com/ (click on the WinIO link)

You may also want to check out Jan Axelson's Parallel Port Complete from your library, as (I think, can't remember for sure) it has some good information on accessing the parallel port from VB.
0
RocketMan801Commented:
an free and easy driver is here to download:
http://www.geekhideout.com/iodll.shtml

io.dll

theres a txt file with help about the driver, it reaally easy to use (1 code line to read)
0
mswatAuthor Commented:
Whenever I try to add a reference to these dll's under VB.NET (DOT NET) I get an error saying that the file is not a valid assembly and is not supported. Is there a way around this or is the dll not supported by VB.NET?
0
Cloud Class® Course: C++ 11 Fundamentals

This course will introduce you to C++ 11 and teach you about syntax fundamentals.

rkosaiCommented:
You may need to use the older VB method of using libraries:

The website suggested by Rocketman801 includes these Visual Basic Prototypes:
Private Declare Sub PortOut Lib "IO.DLL" (ByVal Port As Integer, ByVal Data As Byte)
Private Declare Sub PortWordOut Lib "IO.DLL" (ByVal Port As Integer, ByVal Data As Integer)
Private Declare Sub PortDWordOut Lib "IO.DLL" (ByVal Port As Integer, ByVal Data As Long)
Private Declare Function PortIn Lib "IO.DLL" (ByVal Port As Integer) As Byte
Private Declare Function PortWordIn Lib "IO.DLL" (ByVal Port As Integer) As Integer
Private Declare Function PortDWordIn Lib "IO.DLL" (ByVal Port As Integer) As Long
Private Declare Sub SetPortBit Lib "IO.DLL" (ByVal Port As Integer, ByVal Bit As Byte)
Private Declare Sub ClrPortBit Lib "IO.DLL" (ByVal Port As Integer, ByVal Bit As Byte)
Private Declare Sub NotPortBit Lib "IO.DLL" (ByVal Port As Integer, ByVal Bit As Byte)
Private Declare Function GetPortBit Lib "IO.DLL" (ByVal Port As Integer, ByVal Bit As Byte) As Boolean
Private Declare Function RightPortShift Lib "IO.DLL" (ByVal Port As Integer, ByVal Val As Boolean) As Boolean
Private Declare Function LeftPortShift Lib "IO.DLL" (ByVal Port As Integer, ByVal Val As Boolean) As Boolean
Private Declare Function IsDriverInstalled Lib "IO.DLL" As Boolean

You can add these into a module, and reference them as functions in your code.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
RocketMan801Commented:
1º first copy io.dll in the bin folder where are the compiled binaries of your application

2º declare a function from the io.dll, for example
Private Declare Sub SetPortBit Lib "IO.DLL" (ByVal Port As Integer, ByVal Bit As Byte)
(not necesarily in a module)

3º use the function, for example:
Call SetPortBit(&H378, Val(Text1.Text))

4º thats all dude!
0
games0802Commented:
Even though this question is closed, I thought I would put my 2 cents in.

I'm developing a C# program where I needed to manipulate the parallel port.  I used a program written in C to access it called PortTalk.  The process to create a dll which is easily called from C# or VB.NET was painless.  I use inport(ushort addr) and outport(ushort addr, byte val) to read and write the addresses.  You may email me at games0802 At hotmail Dot com for more info.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Programming Languages-Other

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.