Link to home
Start Free TrialLog in
Avatar of hccao
hccao

asked on

Visual C++ & Parallel Port

How can the parallel port be written or read(every single pin) using Visual C++(version 4.2 or 5.0)?
ASKER CERTIFIED SOLUTION
Avatar of os012897
os012897

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of messiah
messiah

Come on man, if you're gonna answer the question, answer the question. Beating around the bush helps no one.
I do not think this was beating on the bush ....

This is the principal way how to do it. Nevertheless it is true that the answer is generic, although the question specifically conentrated on a solution for VC++. I do not have the documentation for VC++ available at the moment, which was the reason for the generic way of my answer.

I would recommend hccao to therefore reject my answer in case it did not help. If anybody (messiah?) has the exact solution to the problem, post it.

If noone could answer it till monday, I will look some more info up at work and post it is a comment.

Greetings,
   
                 os

The reason why I intervened was not because I could come up with a better answer, but that I could benefit from the answer as I am having the exact same problem.

BTW: I did not mean to offend you or anyone else, just merely stating that the answer wasn't really an answer :)

-messiah
No offense taken :)

os

I took a look at my documentation at work and have to say that I wont be able to come up with a proper solution.

As under DOS you can use the int17h to send and retrieve data and status of a printer, (which gave u about 16 pins to read and write) I assumed wrongly that there is a straight forward way to this in Windows too.

The farthest I got were the SetPrinter and GetPrinter functions that let you set and retrieve the status of the printer.Though those will give u access to at most 8 pins of the port in case it somehow corresponds to the behaviour of the DOS-printer status.

With the WritePrinter and ReadPrinter you should be able write and read another 8-bits of the port.

So you could probably get 16 pins working for you, though it is a pretty humble way, in case it works at all.

Hmmm ... a better way would probably be to search for a library that accesses the parallel port bitwise via the printer-device-driver.

I'd put the question back for evaluation, as there might be someone who solved it properly.

Greetings,

        os

Wow, thanks os.. you got me thinking :)