Solved

Visual C++ & Parallel Port

Posted on 1997-12-18
7
556 Views
Last Modified: 2013-11-15
How can the parallel port be written or read(every single pin) using Visual C++(version 4.2 or 5.0)?
0
Comment
Question by:hccao
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
7 Comments
 
LVL 3

Accepted Solution

by:
os012897 earned 100 total points
ID: 1176749
Hi hccao,

There are functions to do this, though I do not remember the exact name of them. Search in help for "Comm" or "port" ....

Accessing *every* single pin could be a problem. You can access the 8 different data-pins easily using bit-masks. The other pins are status indicators (e.g. on/offline of a printer). You can access those pins using status-read or write functions. I am not sure whether all pins can be accessed that way though.

Greetings,

            os

0
 
LVL 1

Expert Comment

by:messiah
ID: 1176750
Come on man, if you're gonna answer the question, answer the question. Beating around the bush helps no one.
0
 
LVL 3

Expert Comment

by:os012897
ID: 1176751
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

0
Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

 
LVL 1

Expert Comment

by:messiah
ID: 1176752
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
0
 
LVL 3

Expert Comment

by:os012897
ID: 1176753
No offense taken :)

os

0
 
LVL 3

Expert Comment

by:os012897
ID: 1176754
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

0
 
LVL 1

Expert Comment

by:messiah
ID: 1176755
Wow, thanks os.. you got me thinking :)
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This guide will walk you through the essential considerations and tech stack for building scalable websites. Know how to grow your business the smart way!
This article was originally published on Monitis Blog, you can check it here . If you have responsibility for software in production, I bet you’d like to know more about it. I don’t mean that you’d like an extra peek into the bowels of the sourc…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
The viewer will learn how to successfully download and install the SARDU utility on Windows 8, without downloading adware.

636 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question