Solved

Visual C++ & Parallel Port

Posted on 1997-12-18
7
548 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
Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

 
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

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Dropbox 3 72
Backup and restore to dissimilar hardware 7 82
How to convert MFC::CString to UTF8 wchar_t* 10 148
How to print into std::string like sprintf using C++11? 12 50
Storage devices are generally used to save the data or sometime transfer the data from one computer system to another system. However, sometimes user accidentally erased their important data from the Storage devices. Users have to know how data reco…
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!
Viewers will learn how to use the Hootsuite Dashboard.
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

867 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

15 Experts available now in Live!

Get 1:1 Help Now