step in-between printer (LPT)

W

werdna.sivad

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!
 
F

Flash Gordon

(e-mail address removed) wrote:

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.
 
K

Kellie Fitton

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/default.asp?url=/library/en-us/fileio/fs/createfile.asp

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/devio/base/getcommstate.asp

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/devio/base/buildcommdcb.asp

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/fileio/fs/readfile.asp

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/fileio/fs/writefile.asp

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/devio/base/clearcommerror.asp

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnfiles/html/msdn_serial.asp


http://msdn.microsoft.com/library/default.asp?url=/library/en-us/gdi/prntspol_2cj7.asp

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/gdi/prntspol_994j.asp

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/gdi/prntspol_17qr.asp

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/gdi/prntspol_109u.asp

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/gdi/prntspol_87zo.asp

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/gdi/prntspol_13ua.asp

Hope these information helps,

Kellie.
 
K

Keith Thompson

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.
 
B

Bob Masta

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
 
F

Flash Gordon

Bob Masta wrote:

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.
 
K

Kellie Fitton

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/default.asp?url=/library/en-us/devio/base/deviceiocontrol.asp

http://msdn.microsoft.com/library/d..._073c89bd-90d5-4140-931a-4e44d2234cad.xml.asp

Hope these information helps,

Kellie.
 
F

Flash Gordon

Kellie said:
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/co...ddd5c7f0113/844fc503a9633784#844fc503a9633784

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!
 
A

Alf P. Steinbach

* 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.
 
K

Keith Thompson

Flash Gordon said:
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.
 
K

Kellie Fitton

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. :--))
 
D

David J. Craig

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).
 
S

Skarmander

David said:
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.
 
R

Richard Heathfield

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,013
Latest member
KatriceSwa

Latest Threads

Top