FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin para Harbour/xHarbour TDosPrint y detectar estado de la impresora
Posts: 728
Joined: Fri Oct 07, 2005 07:38 AM
TDosPrint y detectar estado de la impresora
Posted: Sun Apr 02, 2006 10:23 AM

Buenasssss gente.
Vereis uso tdosprint para imprimir en impresoras de tiquets, el tema es que cuando la impresora no responde (apagada, sin papel, etc...) se me cuelga la aplicaci贸n.
Hay forma de averiguar el estado de la impresora antes de lanzar el tdosprint?, generalmente la impresora esta conectada por el puerto paralelo.

Gracias.
Un saludo
Angel Salom

angel@sigev.com

FWH2.7+Harbour+BCC

Angel Salom
Visionwin Software - https://www.visionwin.com
------------------------------------------------------------
fwh 19.05 - harbour 3.2 - bcc 7.4
Posts: 69
Joined: Wed Mar 29, 2006 10:54 PM
TDosPrint y detectar estado de la impresora
Posted: Sun Apr 02, 2006 01:42 PM

Hola Angel,

Yo utilizo en fw/blinker prnstat, pero en fwh no funciona, te anexo el fuente yo no conozco C, si lo puedes poner a funcionar por favor me lo envias. El uso es muy simple unicamente enlazas el OBJ y antes de imprimir e invocas PRNSTAT( 1 ) y te devuelve .T./.F.

Saludos

Saludos



Alvaro Urdaneta



Fwh 25.09, xharbour1.3.1, bcc77, Brw45

Posts: 69
Joined: Wed Mar 29, 2006 10:54 PM
TDosPrint y detectar estado de la impresora
Posted: Sun Apr 02, 2006 02:11 PM

ooopsss, no lo puse

include <ClipApi.h>

CLIPPER PRNSTATUS() // nPort (LPT1 = 1, LPT2 = 2, ...)
{
int Port = IF( PCOUNT() == 0, 0, _parni( 1 ) - 1);
unsigned char iRetVal = 0;

asm {
mov ah, 02h
mov dx, Port
int 17h
mov iRetVal, ah
}

_retl( iRetVal == 0x90 );
}

Saludos

Saludos



Alvaro Urdaneta



Fwh 25.09, xharbour1.3.1, bcc77, Brw45

Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
TDosPrint y detectar estado de la impresora
Posted: Sun Apr 02, 2006 02:18 PM

Alvaro,

> int 17h

Las interrupciones (int) no se pueden usar en 32 bits.

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 69
Joined: Wed Mar 29, 2006 10:54 PM
TDosPrint y detectar estado de la impresora
Posted: Sun Apr 02, 2006 02:54 PM

Antonio,

No conozco C, podrias por favor modificarla y generar un OBJ, o existe algo en FWH que funcione parecido, gracias.

Saludos

Saludos



Alvaro Urdaneta



Fwh 25.09, xharbour1.3.1, bcc77, Brw45

Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
TDosPrint y detectar estado de la impresora
Posted: Sun Apr 02, 2006 03:07 PM
Alvaro,

Tal vez esta pueda servir:
CLIPPER PRNSTATUS( PARAMS ) // cPrinter or cPrinterServer --> nStatus
{
	 HANDLE hPrinter = NULL;
	 DWORD cBytesNeeded = 0, cBytesUsed = 0, status = 0;
   PRINTER_INFO_2 * pPrinterInfo = NULL;   	
   
   if( OpenPrinter( _parc( 1 ), &hPrinter, NULL ) )
   {
      GetPrinter( hPrinter, 2, NULL, 0, &cBytesNeeded );
      pPrinterInfo = ( PRINTER_INFO_2 * ) _xgrab( cBytesNeeded );   		
   	  GetPrinter( hPrinter, 2, ( unsigned char * ) pPrinterInfo, cBytesNeeded, &cBytesUsed );
   	  _retnl( pPrinterInfo->Status );
   	  _xfree( pPrinterInfo );
      ClosePrinter( hPrinter );
   }
   else
      _retnl( PRINTER_STATUS_NOT_AVAILABLE );
}

Este es un ejemplo de uso:
#define PRINTER_STATUS_OK                       0
#define PRINTER_STATUS_PAUSED                   1
#define PRINTER_STATUS_ERROR                    2
#define PRINTER_STATUS_PENDING_DELETION         4
#define PRINTER_STATUS_PAPER_JAM                8
#define PRINTER_STATUS_PAPER_OUT               16
#define PRINTER_STATUS_MANUAL_FEED             32
#define PRINTER_STATUS_PAPER_PROBLEM           64
#define PRINTER_STATUS_OFFLINE                128
#define PRINTER_STATUS_IO_ACTIVE              256
#define PRINTER_STATUS_BUSY                   512
#define PRINTER_STATUS_PRINTING              1024
#define PRINTER_STATUS_OUTPUT_BIN_FULL       2048
#define PRINTER_STATUS_NOT_AVAILABLE         4096
#define PRINTER_STATUS_WAITING               8192
#define PRINTER_STATUS_PROCESSING           16384
#define PRINTER_STATUS_INITIALIZING         32768
#define PRINTER_STATUS_WARMING_UP           65536
#define PRINTER_STATUS_TONER_LOW           131072
#define PRINTER_STATUS_NO_TONER            262144
#define PRINTER_STATUS_PAGE_PUNT           524288
#define PRINTER_STATUS_USER_INTERVENTION  1048576
#define PRINTER_STATUS_OUT_OF_MEMORY      2097152
#define PRINTER_STATUS_DOOR_OPEN          4194304
#define PRINTER_STATUS_SERVER_UNKNOWN     8388608
#define PRINTER_STATUS_POWER_SAVE        16777216

function Main()

   local nStatus := PrnStatus( "LPT1:" )

   MsgInfo( nStatus )

return nil

Y este es el OBJ a reemplazar en FiveHC.lib:
http://hyperupload.com/download/01b93ba ... C.obj.html
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 728
Joined: Fri Oct 07, 2005 07:38 AM
TDosPrint y detectar estado de la impresora
Posted: Sun Apr 02, 2006 03:49 PM

Fant谩stico maestro. Funcion贸 perfecto.

Angel Salom
Visionwin Software - https://www.visionwin.com
------------------------------------------------------------
fwh 19.05 - harbour 3.2 - bcc 7.4
Posts: 69
Joined: Wed Mar 29, 2006 10:54 PM
TDosPrint y detectar estado de la impresora
Posted: Sun Apr 02, 2006 04:22 PM

Antonio,

Funciona perfecto, muchas gracias. Una pregunta, en un futuro esta funcion puede incluirse en FWH ?

Saludos

Saludos



Alvaro Urdaneta



Fwh 25.09, xharbour1.3.1, bcc77, Brw45

Posts: 728
Joined: Fri Oct 07, 2005 07:38 AM
TDosPrint y detectar estado de la impresora
Posted: Sun Apr 02, 2006 04:50 PM

Parece que me precipit茅. Siempre me devuelve 4096, impresora no lista.
Estar茅 haciendo algo mal o hay algun problema con la funci贸n???
Es una impresora de tiquets conectada directamente al pc por lpt1

Angel Salom
Visionwin Software - https://www.visionwin.com
------------------------------------------------------------
fwh 19.05 - harbour 3.2 - bcc 7.4
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
TDosPrint y detectar estado de la impresora
Posted: Sun Apr 02, 2006 06:50 PM

Angel,

Es una funci贸n nueva en pruebas, probablemente haya que modificarla.

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 16
Joined: Thu Jun 15, 2006 09:46 PM
TDosPrint y detectar estado de la impresora
Posted: Tue Aug 08, 2006 02:01 PM

Tambien realize algunas pruebas pero me marca el mismo error
yo trato de monitorear el estado de una impresora pero conectada por un puerto tcp/ip osea ip_192.25.12.x , y tampoco. real mente lo q necesito es
saber cuando termino el trabajo de imprecion ya q al mandar varios reportes de crystal el sistema aborta. entonces lo q pretendo hacer es monitorear el estatus de la impresion y mandarlo asta q este lista la impresora ya q si mando pocos reportes de crystal directo a la impresora si funciona, pero si mando mas este se cuelga,y manda un extra帽o mensage de error, cuando mando aimprimir directo el reporte sin previsulizar este, pero algo extra帽o ya q si hago una previsualizacion no manda el msg de error.

Posts: 253
Joined: Fri Feb 03, 2006 04:21 PM
TDosPrint y detectar estado de la impresora
Posted: Wed Nov 08, 2006 04:01 PM

function Main()

local nStatus := PrnStatus( "LPT1: ")

MsgInfo( nStatus )

// sempre retorna 4096

return nil

Thanks,
Ari

FWH 2501 - Harbour 3.2.0 - Embarcadero 7.43 - MySQL
S茫o Paulo - SP - Brasil
www.sisrev.com.br
Posts: 8515
Joined: Tue Dec 20, 2005 07:36 PM
TDosPrint y detectar estado de la impresora
Posted: Wed Nov 08, 2006 04:23 PM

Testem este ejemplo de TDOSPRN.PRG Espero que ayude.

http://www.fivewin.com.br/exibedicas.asp?id=496

Jo茫o Santos - S茫o Paulo - Brasil - Phone: +55(11)95150-7341

Continue the discussion