By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,501 Members | 1,720 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,501 IT Pros & Developers. It's quick & easy.

step in-between printer (LPT)

P: n/a
I need to develop some software that will step in between a computer
and it's printer. The software should read from one LPT port
(connected to printing computer) and then redirect that traffic out a
second LPT port (connected to printer). It will do stuff to the data
as it goes by. Can you give me any direction on what is needed to
develop this? How do I read/write to/from the LPT port in Windows?
Are there any libraries available that can manage the communications?
Do I need to develop a driver to do this?

Thanks!

Nov 22 '05 #1
Share this Question
Share on Google+
14 Replies


P: n/a
Hi,

You can use the following API's to handle the parallel port:

CreateFile()
GetCommState()
BuildCommDCB()
SetCommState()
GetCommTimeouts()
SetCommTimeouts()
ReadFile()
WriteFile()
CloseHandle()
CancelIo()
ClearCommError()
FlushFileBuffers()

You can use the following API's to handle the print jobs:

EnumJobs() using JOB_INFO_1, JOB_INFO_2
EnumPorts()
EnumMonitors()
SetJob()
SetPort()
SetPrinter()

http://msdn.microsoft.com/library/de...createfile.asp

http://msdn.microsoft.com/library/de...tcommstate.asp

http://msdn.microsoft.com/library/de...ildcommdcb.asp

http://msdn.microsoft.com/library/de...s/readfile.asp

http://msdn.microsoft.com/library/de.../writefile.asp

http://msdn.microsoft.com/library/de...rcommerror.asp

http://msdn.microsoft.com/library/de...sdn_serial.asp
http://msdn.microsoft.com/library/de...tspol_2cj7.asp

http://msdn.microsoft.com/library/de...tspol_994j.asp

http://msdn.microsoft.com/library/de...tspol_17qr.asp

http://msdn.microsoft.com/library/de...tspol_109u.asp

http://msdn.microsoft.com/library/de...tspol_87zo.asp

http://msdn.microsoft.com/library/de...tspol_13ua.asp

Hope these information helps,

Kellie.

Nov 22 '05 #2

P: n/a
we**********@gmail.com writes:
I need to develop some software that will step in between a computer
and it's printer. The software should read from one LPT port
(connected to printing computer) and then redirect that traffic out a
second LPT port (connected to printer).

[...]

This is off-topic in (at least) comp.lang.c and comp.lang.c++.
(Cross-posting to five newsgroups is rarely a good idea.)

Followups redirected.

--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
Nov 22 '05 #3

P: n/a
There is a Port Monitoring section under the DDK. That might help.

http://msdn.microsoft.com/library/de...asp?frame=true

This is an example of how to redirect a printer job to a file, instead of
the physical printer it was going to:

http://www.codeguru.com/Cpp/W-P/prin...icle.php/c5893

AliR.
<we**********@gmail.com> wrote in message
news:11*********************@z14g2000cwz.googlegro ups.com...
I need to develop some software that will step in between a computer
and it's printer. The software should read from one LPT port
(connected to printing computer) and then redirect that traffic out a
second LPT port (connected to printer). It will do stuff to the data
as it goes by. Can you give me any direction on what is needed to
develop this? How do I read/write to/from the LPT port in Windows?
Are there any libraries available that can manage the communications?
Do I need to develop a driver to do this?

Thanks!

Nov 22 '05 #4

P: n/a
we**********@gmail.com wrote:

<snip>
develop this? How do I read/write to/from the LPT port in Windows?
Are there any libraries available that can manage the communications?
Do I need to develop a driver to do this?


This is all highly system specific and therefore not topical in
comp.lang.c or comp.lang.c++ so please keep all replies out of these groups.

Followups set.
--
Flash Gordon
Living in interesting times.
Although my email address says spam, it is real and I read it.
Nov 22 '05 #5

P: n/a
On 21 Nov 2005 10:36:25 -0800, "Kellie Fitton"
<KE**********@YAHOO.COM> wrote:
Hi,

You can use the following API's to handle the parallel port:

CreateFile()
GetCommState()
BuildCommDCB()
SetCommState()
GetCommTimeouts()
SetCommTimeouts()
ReadFile()
WriteFile()
CloseHandle()
CancelIo()
ClearCommError()
FlushFileBuffers()


<snip>

Kellie, it sounds like you are thinking of the *serial* port here.
Or is there some tricky way to use DCBs and other comm stuff
with a parallel port?

In particular, I am interested in being able to read port status
lines. I don't much care which line, just some way to be able
to read a digital state. (No physical printer.) I am aware of
special installable drivers like GiveIO for port access, but that
seems like overkill if there is some easy Windows API.

Many thanks!

Bob Masta
dqatechATdaqartaDOTcom

D A Q A R T A
Data AcQuisition And Real-Time Analysis
www.daqarta.com
Home of DaqGen, the FREEWARE signal generator
Nov 24 '05 #6

P: n/a
Bob Masta wrote:

<snip>
seems like overkill if there is some easy Windows API.


Please take comp.lang.c and comp.lang.c++ OFF the cross post list as
both myself and Keith requested days ago. I would be very surprised if
neither of out posts requesting this reached you, since they definitely
left our servers and got as far as Google.

Windows specific, Unix specifics, and any other system specifics are OFF
topic in both comp.lang.c and comp.lang.c++

Follow-ups set again.
--
Flash Gordon
Living in interesting times.
Although my email address says spam, it is real and I read it.
Nov 24 '05 #7

P: n/a
Hi Bob,

If you are trying to communicate with a printer/device that is
biDirectional and supports IEEE1284, for reading you have several
options depending on your port hardWare:

1). Nibble mode
2). Byte mode
3). Fast byte mode with hardWare handShake

The Win32 API's that build/set the DCB structure are used mainly
to reinitialize all hardWare and control settings on the machine,
for example the member ByteSize (number of bits/byte, 4-8), and to
set only a few members of the DCB structure, you should modify the
structure that has been filled in by using the following API's:

GetCommState()
BuildCommDCB()
SetCommState()

Additionally, you should take a look at the Windows Driver Kit,
in particular the Internal Device Control Requests for Parallel
Ports, case in point:

DeviceIoControl()

IOCTL_INTERNAL_GET_MORE_PARALLEL_PORT_INFO
IOCTL_INTERNAL_GET_PARALLEL_PNP_INFO
IOCTL_INTERNAL_GET_PARALLEL_PORT_INFO

http://msdn.microsoft.com/library/de...eiocontrol.asp

http://msdn.microsoft.com/library/de...234cad.xml.asp

Hope these information helps,

Kellie.

Nov 25 '05 #8

P: n/a
Kellie Fitton wrote:
Hi Bob,

If you are trying to communicate with a printer/device that is
biDirectional and supports IEEE1284, for reading you have several
options depending on your port hardWare:


<snip off topic rubbish>

How often do I have to say in the same damn thread, KEEP THIS SYSTEM
SPECIFIC STUFF OFF comp.lang.c and comp.lang.c++!

You have absolutely NO excuse for failing to see the previous polite
requests, since they are plainly visible in Google Groups, and you are
posting from Google groups.

Look at
http://groups.google.co.uk/group/com...4fc503a9633784

Three POLITE requests, one above from the day BEFORE you posted and TWO
below from THREE DAYS before you posted. I know damn well that the ones
from three days ago were visible in Google groups BEFORE you posted.

Follow ups set AGAIN!
--
Flash Gordon
Living in interesting times.
Although my email address says spam, it is real and I read it.
Nov 25 '05 #9

P: n/a
* Kellie Fitton:
[off-topic ramble]


Hi Kellie. You're of great help in Microsoft groups; your lists of
relevant API functions are setting the standard for others. But please
don't post off-topic in clc and clc++: trim the group-list, honor FUTs.

--
A: Because it messes up the order in which people normally read text.
Q: Why is it such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?
Nov 25 '05 #10

P: n/a
Flash Gordon <sp**@flash-gordon.me.uk> writes:
[...]
Three POLITE requests, one above from the day BEFORE you posted and
TWO below from THREE DAYS before you posted. I know damn well that the
ones from three days ago were visible in Google groups BEFORE you
posted.

Follow ups set AGAIN!


Followups unset because I'm not discussing the original question.

It occurs to me that setting followups on a response that asks people
to post only to appropriate newsgroups is of limited utility. Anybody
participating in the discussion is going to post a followup to the
original article or to a relevant response, not to one requesting
proper followups. Readers *should* read the entire thread before
responding, and the original poster should post only to relevant
newsgroups, but once the error has been made it's difficult to correct
it, and many readers probably don't know how to adjust headers anyway.
The only real solution would be to go back to the orginal article and
correct its Followup-To: header, but there's no way to do that.

I think the continued followups to comp.lang.c and comp.lang.c++ are
the result of understandable carelessness, not malice.

--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
Nov 25 '05 #11

P: n/a
Hi Red Floyd, Flash Gordon, Alf Steinbach,

I am really sorry for the multiple posting in these newsGroups,
however, it is not my fault, I have tried to trim or remove the
additional newsGroup names but withOut any luck. I am posting
multiple this time just to say I am sorry again.

Kellie. :--))

Nov 25 '05 #12

P: n/a
Find a new reader or get some help. Some newsgroup types get real upset if
someone violates their 'rules'. This rule is fairly common and even makes
sense. I prefer top post and only rag on bottom posters if I see them
pushing it as the only way it should be done. If you are following a thread
in a news reader, all you need from the next post is the new stuff and
having to scroll to the end is a real pain - IMHO (or not so humble).

"Kellie Fitton" <KE**********@YAHOO.COM> wrote in message
news:11**********************@g47g2000cwa.googlegr oups.com...
Hi Red Floyd, Flash Gordon, Alf Steinbach,

I am really sorry for the multiple posting in these newsGroups,
however, it is not my fault, I have tried to trim or remove the
additional newsGroup names but withOut any luck. I am posting
multiple this time just to say I am sorry again.

Kellie. :--))

Nov 26 '05 #13

P: n/a
David J. Craig wrote:
"Kellie Fitton" <KE**********@YAHOO.COM> wrote in message
news:11**********************@g47g2000cwa.googlegr oups.com...
Hi Red Floyd, Flash Gordon, Alf Steinbach,

I am really sorry for the multiple posting in these newsGroups,
however, it is not my fault, I have tried to trim or remove the
additional newsGroup names but withOut any luck. I am posting
multiple this time just to say I am sorry again.

Find a new reader or get some help. Some newsgroup types get real
upset if someone violates their 'rules'. This rule is fairly common
and even makes sense. I prefer top post and only rag on bottom
posters if I see them pushing it as the only way it should be done.
If you are following a thread in a news reader, all you need from the
next post is the new stuff and having to scroll to the end is a real
pain - IMHO (or not so humble).

Yes, exactly. The way to get this mess over crossposting out of our
collective systems is to start a flame about top vs. bottom posting...
or not. :-D

Followups to alt.dev.null, where crossposts go to die.

S.
Nov 26 '05 #14

P: n/a
David J. Craig said:
If you are following a
thread in a news reader, all you need from the next post is the new stuff
and having to scroll to the end is a real pain - IMHO (or not so humble).


If the new stuff is all you need to read, all the rest should be snipped,
except for directly relevant context, which need only be very short, as in
this example. Where context is provided, it makes sense for it to precede
the reply - again as in this example.

If you must top-post, at least have the decency to snip out all the
irrelevant stuff, instead of chewing up everybody's bandwidth for no reason
whatsoever.

--
Richard Heathfield
"Usenet is a strange place" - dmr 29/7/1999
http://www.cpax.org.uk
email: rjh at above domain (but drop the www, obviously)
Nov 26 '05 #15

This discussion thread is closed

Replies have been disabled for this discussion.