| Exibir mensagem anterior :: Exibir próxima mensagem |
| Autor |
Mensagem |
adriano_servitec Colaborador

Registrado: Sexta-Feira, 30 de Janeiro de 2004 Mensagens: 17618
|
|
| Voltar ao Topo |
|
 |
johnny-walker Moderador


Registrado: Sábado, 4 de Outubro de 2003 Mensagens: 10653 Localização: Contagem/MG - BRAZIL
|
Enviada: Dom Jun 18, 2017 1:59 pm Assunto: |
|
|
Oi adriano, tente ver se isto te ajuda:
https://stackoverflow.com/questions/7585084/detect-the-status-of-a-printer-paper
http://www.delphigroups.info/2/2a/19468.html
| Código: | Please use the following function: (sorry for the mess I wrote it in a hurry)
NOTE : include Printers and WinSpool units
procedure TForm1.Button6Click(Sender: TObject);
var
pcbNeeded : DWord;
prn : THandle;
x : array[0..255] of char;
stat : Pprinterinfo2;
begin
getmem(stat, 1000);
try
StrPCopy(x, printer.printers[0]);
if OpenPrinter(x, prn, nil) then
if GetPrinter(
prn,
2, // version of printer info data structure
stat, // pointer to array of bytes that receives printer info. structure
1000, // size, in bytes, of array of bytes
@pcbNeeded // pointer to variable with count of bytes retrieved (or required)
) then
case stat.status of
PRINTER_STATUS_BUSY : ShowMessage(' The printer is busy.');
PRINTER_STATUS_DOOR_OPEN : ShowMessage(' The printer door is open.');
PRINTER_STATUS_ERROR : ShowMessage('The printer is in an error state.');
PRINTER_STATUS_INITIALIZING : ShowMessage('The printer is initializing.');
PRINTER_STATUS_IO_ACTIVE : ShowMessage('The printer is in an active input/output state.');
PRINTER_STATUS_MANUAL_FEED : ShowMessage('The printer is in a manual feed state.');
PRINTER_STATUS_NO_TONER : ShowMessage('The printer is out of toner.');
PRINTER_STATUS_NOT_AVAILABLE : ShowMessage('The printer is not available for printing.');
PRINTER_STATUS_OFFLINE : ShowMessage('The printer is offline.');
PRINTER_STATUS_OUT_OF_MEMORY : ShowMessage('The printer has run out of memory.');
PRINTER_STATUS_OUTPUT_BIN_FULL : ShowMessage('The printers output bin is full.');
PRINTER_STATUS_PAGE_PUNT : ShowMessage('The printer cannot print the current page.');
PRINTER_STATUS_PAPER_JAM : ShowMessage('Paper is jammed in the printer');
PRINTER_STATUS_PAPER_OUT : ShowMessage('The printer is out of paper.');
PRINTER_STATUS_PAPER_PROBLEM : ShowMessage('The printer has a paper problem.');
PRINTER_STATUS_PAUSED : ShowMessage('The printer is paused.');
PRINTER_STATUS_PENDING_DELETION : ShowMessage('The printer is deleting a print job.');
PRINTER_STATUS_PRINTING : ShowMessage('The printer is printing.');
PRINTER_STATUS_PROCESSING : ShowMessage('The printer is processing a print job.');
PRINTER_STATUS_TONER_LOW : ShowMessage('The printer is low on toner.');
PRINTER_STATUS_USER_INTERVENTION : ShowMessage('The user needs to do something to the printer.');
PRINTER_STATUS_WAITING : ShowMessage('The printer is waiting.');
PRINTER_STATUS_WARMING_UP : ShowMessage('The printer is warming up.');
end else caption := inttostr(getlasterror);
ClosePrinter(prn);
finally
if stat <> nil then freemem(stat, 1000);
end;
end; |
bye _________________ P.O.W.E.R B.Y D.E.L.P.H.I |
|
| Voltar ao Topo |
|
 |
adriano_servitec Colaborador

Registrado: Sexta-Feira, 30 de Janeiro de 2004 Mensagens: 17618
|
|
| Voltar ao Topo |
|
 |
johnny-walker Moderador


Registrado: Sábado, 4 de Outubro de 2003 Mensagens: 10653 Localização: Contagem/MG - BRAZIL
|
|
| Voltar ao Topo |
|
 |
|