• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 793
  • Last Modified:

How to write directly to the LPT port under DELPHI

I have a problem, i want to connect some external electronics to my LPT port, and then i want to be able to write directly to the port. - Is it possible to do, running Windows NT 4 ?  - Please, i need this one badly
0
beamer
Asked:
beamer
1 Solution
 
ZifNabCommented:
Yes, why not?

I can give you already this code. That's the easiest way. It's the way to print by bypassing windows. Don't think it's different to send your codes to your hardware.
But I have also a zip -file with documents very well accessing the hardware ports via delphi 2.0. With examples. I can send it to you, if you want it. Just give me your e-mail adres. I really recommend this file!

var
 f : TextFile;
begin
 AssignFile( f, 'LPT1' );
 Rewrite( f );
  //
  // do your printing here...
  //
 WriteLn( f, {codes});
 CloseFile( f );
end;

(Following:  I'm not sure if you need it)
If you plan on sending control codes to the printer, call this function immediat

 procedure SetBinaryMode (var F: Text);  assembler;

 asm
   mov ax,$4400
   les di,F
   mov bx,word ptr es:[di]
   int $21
   or dl,$20
   xor dh,dh
   mov ax,$4401
   int $21
   end;


This is the read.me file from the zip file I offer you! Like I said it's really good documented. If you really want to program your hardware ports, it just what you need. Really, IT IS!

The Delphi Hardware Programmers's Archive
All of the files in this archive were collected
from FTP sites to illustrate how to interface
Delphi with IBM PC hardware. They are all public
domain and should be used with care. I disclaim
everything, this file is provided as a service
to all who are interested.

GOOD LUCK!      Alan Young
            ajtech@apc.net

DELFHDWR.DOC      Contains a MS Word document
            explaining how to interface
            Delphi with hardware. Contains
            references to the other files
            below.

VBAJGAME.ZIP      Shows how to interface a Delphi
            DLL with Visual Basic. Accesses
            joystick port

LPCTRL.ZIP      Shows how to program parallel LPT
            port in Delphi

HWPORT95.ZIP      A PORT I/O Driver for Win 95. Use
            with Delphi as per document's
            instructions

loaddrv.ZIP      CONTAINS LOADDRV program
            for WinNT. This is for loading
            the giveio.sys driver

DIRECTIO.ZIP      Contains GIVEIO.SYS driver for WINNT.


I'm almost going home. So you have to wait till tomorrow for this file if you don't answer in a half hour.

Need more help, just ask
Have fun,
c.u. ZifNab;
0
 
beamerAuthor Commented:
Thanks for the answer.!

I'll return when i know wether it works or not !

Cya.
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now