Board index » delphi » CreateFile API to access parallel ports

CreateFile API to access parallel ports

How do I use the CreateFile Win32 API to access parallel ports.
I don't want to use a component written by someone else. The definition for
CreateFile in the API guide is complex, and I don't how to pass
parameters to it. Does anyone have any code to demonstrate i/o with
parallel port -- I was told that CreateFile should work with WinNT as
well.

Thanks in advance, please also post to gs...@doc.ic.ac.uk

Gurpal S. Bhachu
Department of Computing
Imperial College
180 Queen's Gate
London SW7

 

Re:CreateFile API to access parallel ports


Don't have any code lying around but what mu might wanna do is get a
parallel port component from the net (fw with source) and check the source
to see how it's done which usually gives rather good insight in how it's
done

HTH
  Roel

Quote
G. Singh <cex...@coventry.ac.uk> wrote:

: How do I use the CreateFile Win32 API to access parallel ports.
: I don't want to use a component written by someone else. The definition for
: CreateFile in the API guide is complex, and I don't how to pass
: parameters to it. Does anyone have any code to demonstrate i/o with
: parallel port -- I was told that CreateFile should work with WinNT as
: well.

: Thanks in advance, please also post to gs...@doc.ic.ac.uk

: Gurpal S. Bhachu
: Department of Computing
: Imperial College
: 180 Queen's Gate
: London SW7

Re:CreateFile API to access parallel ports


Quote
G. Singh <cex...@coventry.ac.uk> wrote:

<message>
How do I use the CreateFile Win32 API to access parallel ports. I don't
want to use a component written by someone else. The definition for
CreateFile in the API guide is complex, and I don't how to pass
parameters to it. Does anyone have any code to demonstrate i/o with
parallel port -- I was told that CreateFile should work with WinNT as
well.
</message>

I haven't accessed the parallel ports, but rather the COM ports. I
suspect the opening them under a 32 bit environment might be similar.
I've used the FileOpen and File Management routines available in D2
using a file name '\\.\COM1' if I were opening COM1 for example. If I
wanted to open LPT1 I might try something like '\\.\LPT1' for a file
name. Hope this helps.

Re:CreateFile API to access parallel ports


The world authority on low-level parallel port access is Jan Axelson,
http://www.lvr.com.  She has downloadable DLLs and such, as well as a good
book.

Other Threads