botones67
22-08-2003, 09:14:42
Ayer muy amablemente delphi.com.ar, me dio una posile solución para saber el estado de la impresora antes de imprimir.
El codigo propuesto no funciona me da error interno de memoria.
code:--------------------------------------------------------------------------------
function PrinterStatus : integer;
asm
mov ah, 2 // function 2 - returns status of port
mov dx, 0 // lpt1 = 0, lpt2 = 1 etc
int $17 // status in ah
mov al, ah
and eax, $FF // status now in eax with top 24 bits cleared
end;
const
PrinterCodes : array [0..7] of string =
('printer timed-out',
'unused',
'unused',
'I/O error',
'printer selected',
'out of paper',
'printer acknowedgment',
'printer not busy');
procedure TForm1.Button1Click(Sender: TObject);
var
L,P : integer;
begin
P := PrinterStatus; //status of printer in P
ListBox1.Clear;
for L := 0 to 7 do
if P and (1 shl L) <> 0 then
ListBox1.Items.Add (PrinterCodes [L]);
end;
Tambien Hizo referencia a crear una instancia de TPrinterStatus y utilizar sus propiedades.
¿ Me podias decir como concretamente como se crea esta instancia y como poder utilizar sus propiedades.?
Saludos y gracias anticipadas.
BOtones67
El codigo propuesto no funciona me da error interno de memoria.
code:--------------------------------------------------------------------------------
function PrinterStatus : integer;
asm
mov ah, 2 // function 2 - returns status of port
mov dx, 0 // lpt1 = 0, lpt2 = 1 etc
int $17 // status in ah
mov al, ah
and eax, $FF // status now in eax with top 24 bits cleared
end;
const
PrinterCodes : array [0..7] of string =
('printer timed-out',
'unused',
'unused',
'I/O error',
'printer selected',
'out of paper',
'printer acknowedgment',
'printer not busy');
procedure TForm1.Button1Click(Sender: TObject);
var
L,P : integer;
begin
P := PrinterStatus; //status of printer in P
ListBox1.Clear;
for L := 0 to 7 do
if P and (1 shl L) <> 0 then
ListBox1.Items.Add (PrinterCodes [L]);
end;
Tambien Hizo referencia a crear una instancia de TPrinterStatus y utilizar sus propiedades.
¿ Me podias decir como concretamente como se crea esta instancia y como poder utilizar sus propiedades.?
Saludos y gracias anticipadas.
BOtones67