Solved

Visual C++ & Parallel Port

Posted on 1997-12-18
7
547 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
  • 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
What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

 
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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Container Orchestration platforms empower organizations to scale their apps at an exceptional rate. This is the reason numerous innovation-driven companies are moving apps to an appropriated datacenter wide platform that empowers them to scale at a …
In this article, you will read about the trends across the human resources departments for the upcoming year. Some of them include improving employee experience, adopting new technologies, using HR software to its full extent, and integrating artifi…
The viewer will learn how to successfully download and install the SARDU utility on Windows 7, without downloading adware.
XMind Plus helps organize all details/aspects of any project from large to small in an orderly and concise manner. If you are working on a complex project, use this micro tutorial to show you how to make a basic flow chart. The software is free when…

708 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now