Re:accessing parallel port through delphi
Use CreateFile to get a handle to it, and then use the usual file
accessing routines
e.g.
Var
lName: Array[0..6] of Char;
lHandle: THandle;
lTest:String;
lBytesWritten: Integer;
Begin
StrPCopy(lName, 'COM1:');
lHandle := CreateFile(lName, GENERIC_READ or GENERIC_WRITE,0,Nil,
OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL, 0);
lTest := 'Test';
WriteFile (lHandle, lTest[1], Length(lTest), lBytesWritten, Nil) ;
CloseHandle(lHanlde);
end;
Reading from the port can be done a similar way
HTH
Allan
Quote
>Does anybody know how to access the parallel ports in delphi, or some
>library that can be used for this?
>Hello everybody. For some reason I need to access the parallel ports of the
>computer. I used to be able to access them through win95 and in a pentium
>100 computer; but now I have to work with win98 and a p2. Assembly code used
>to work in the past, but not anymore.
Allan Carlton
Author of Delphi Central at http://www.innotts.co.uk/~zephyr
Providing Delphi Articles, Tutorials and Hints.