Mega Code Archive

 
Categories / Delphi / Printing
 

Yazıcı kontrol etmek

unit prntest; interface uses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, Buttons; type TForm2 = class(TForm) yazici: TBitBtn; emesgul: TEdit; Ekagityok: TEdit; eariza: TEdit; procedure yaziciClick(Sender: TObject); private { Private declarations } public { Public declarations } function yazicid(yport: integer; ytest : byte; durum:boolean): boolean; end; var Form2: TForm2; durum:boolean; yport:integer; ytest:byte; mesgul:boolean; kagityok:boolean; ariza:boolean; implementation {$R *.DFM} function TForm2.yazicid(yport: integer; ytest:byte; durum:boolean): boolean; asm mov EDX, yport {16 Bit için AX, get printer number - 0 = LPT1, 1 = LPT2, 2 = LPT3 } mov AH, 02h { set AH for BIOS int 17h function 2 } int 17h { do an int 17h to sent to printer } xchg AL, AH { put byte result in AL } test al, ytest jnz @tamam mov al, 00h mov @result, al jmp @son @tamam: mov al, 01 mov @result,al @son: end; procedure TForm2.yaziciClick(Sender: TObject); begin mesgul := yazicid(00, 128, false); if mesgul then emesgul.text := 'hazır' else emesgul.text := 'meşgul'; kagityok := yazicid(00, 32, false); if kagityok then ekagityok.text := 'kağıt yok' else ekagityok.text := 'kağıt var'; ariza := yazicid(00, 8, false); if ariza then eariza.text := 'arızalı' else eariza.text := 'faal'; end; end.