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!

Re: step in-between printer (LPT) by Kellie

Kellie
Mon Nov 21 12:36:25 CST 2005

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.


Re: step in-between printer (LPT) by Keith

Keith
Mon Nov 21 13:00:39 CST 2005

werdna.sivad@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) kst-u@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.

Re: step in-between printer (LPT) by AliR

AliR
Mon Nov 21 13:01:26 CST 2005

There is a Port Monitoring section under the DDK. That might help.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/graphics/hh/graphics/provider_81f595db-3146-48ba-8d0b-5eabe4fdb340.xml.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/printing/article.php/c5893

AliR.


<werdna.sivad@gmail.com> wrote in message
news:1132596113.422051.29100@z14g2000cwz.googlegroups.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!
>



Re: step in-between printer (LPT) by Flash

Flash
Mon Nov 21 12:36:02 CST 2005

werdna.sivad@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.

Re: step in-between printer (LPT) by NoSpam

NoSpam
Thu Nov 24 10:06:38 CST 2005

On 21 Nov 2005 10:36:25 -0800, "Kellie Fitton"
<KELLIEFITTON@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

Re: step in-between printer (LPT) by Flash

Flash
Thu Nov 24 12:33:26 CST 2005

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.

Re: step in-between printer (LPT) by Kellie

Kellie
Thu Nov 24 18:23:25 CST 2005

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/default.asp?url=/library/en-us/ParPorts_r/hh/ParPorts_r/cisspd_073c89bd-90d5-4140-931a-4e44d2234cad.xml.asp

Hope these information helps,

Kellie.


Re: step in-between printer (LPT) by red

red
Thu Nov 24 23:04:08 CST 2005

Kellie Fitton wrote:
> [redacted]

Please take this discussion off of comp.lang.c and comp.lang.c++.

It is off topic for those forums.


Re: step in-between printer (LPT) by Flash

Flash
Fri Nov 25 04:50:23 CST 2005

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/comp.lang.c/browse_frm/thread/ccdfbddd5c7f0113/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!
--
Flash Gordon
Living in interesting times.
Although my email address says spam, it is real and I read it.

Re: step in-between printer (LPT) by alfps

alfps
Fri Nov 25 05:15:01 CST 2005

* 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?

Re: step in-between printer (LPT) by Keith

Keith
Fri Nov 25 11:15:55 CST 2005

Flash Gordon <spam@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) kst-u@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.

Re: step in-between printer (LPT) by Kellie

Kellie
Fri Nov 25 16:06:05 CST 2005

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


Re: step in-between printer (LPT) by David

David
Fri Nov 25 22:05:35 CST 2005

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" <KELLIEFITTON@YAHOO.COM> wrote in message
news:1132956365.100581.166690@g47g2000cwa.googlegroups.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. :--))
>



Re: step in-between printer (LPT) by Skarmander

Skarmander
Fri Nov 25 22:31:44 CST 2005

David J. Craig wrote:
> "Kellie Fitton" <KELLIEFITTON@YAHOO.COM> wrote in message
> news:1132956365.100581.166690@g47g2000cwa.googlegroups.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.

Re: step in-between printer (LPT) by Richard

Richard
Sat Nov 26 03:00:36 CST 2005

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)