Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

How do i write directly to a printer port?

Hi, how are you?
Thank you for reading this message!

Does anybody know how to write directly to a printer port!
I'm designing an aplication that needs to write data to the printer (Ticket printer)! If i use windows to do it it's extremely slow, so i thougt of writing directly to it using the printers own commands! But to do that i need to know how to write directly to the printer port(s)!

If anybody could help me i would be very greatfull!
Thank's anyway and good bye...

Luis Semedo Duarte

Comments

  • ComboyComboy Member Posts: 4
    Hi Luis,
    Try this code:

    uses
    printers;
    var
    text1:textfile;
    begin
    assignprn(text1);
    rewrite(text1);
    writeln(text1,'Writing to the printer port!');
    closefile(text1);
    end;

    I didn't check it yet, because I don't have a printer, so I'm not sure if it works or not, but it may work.
    Have fun Pal,

    Comboy.
    ________________________________________________________
    Does anybody know how to write directly to a printer port!
    I'm designing an aplication that needs to write data to the printer(Ticket printer)! If i use windows to do it it's extremely slow, so i thougt of writing directly to it using the printers own commands! But to do that i need to know how to write directly to the printer port(s)!

    Luis Semedo Duarte
    ________________________________________________________

  • dj_sanniedj_sannie Member Posts: 92
    : Hi, how are you?
    : Thank you for reading this message!
    :
    : Does anybody know how to write directly to a printer port!
    : I'm designing an aplication that needs to write data to the printer (Ticket printer)! If i use windows to do it it's extremely slow, so i thougt of writing directly to it using the printers own commands! But to do that i need to know how to write directly to the printer port(s)!
    :
    : If anybody could help me i would be very greatfull!
    : Thank's anyway and good bye...
    :
    : Luis Semedo Duarte
    :

    Hi i don't know how u speek to the printer port
    But the official windows 95/98/me command is
    [Code]
    HANDLE CreateFile(
    LPCTSTR lpFileName,
    DWORD dwDesiredAccess,
    DWORD dwShareMode,
    LPSECURITY_ATTRIBUTES lpSecurityAttributes,
    DWORD dwCreationDisposition,
    DWORD dwFlagsAndAttributes,
    HANDLE hTemplateFile );
    [/Code]
    To open a printerport and
    [code]
    BOOL WriteFile(
    HANDLE hFile,
    LPCVOID lpBuffer,
    DWORD nNumberOfBytesToWrite,
    LPDWORD lpNumberOfBytesWritten,
    LPOVERLAPPED lpOverlapped );
    [/code]
    To Write To It. (In Delphi The Parameter Types Are Different)

    but to do it in windows 2000/XP
    u must be a driver, this is verry complexed
    (I'm not able to do this)

    so i'wil give u the advise to use "ZlPortIO"

    this is a unit allong whit a .sys file that can handle
    it for u

    Greetz

    DJ Sannie
Sign In or Register to comment.