TDosPrint y detectar estado de la impresora

TDosPrint y detectar estado de la impresora

Postby AngelSalom » 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
User avatar
AngelSalom
 
Posts: 708
Joined: Fri Oct 07, 2005 7:38 am
Location: Benicarló (Castellón ) - España

Postby Alvaro Urdaneta » Sun Apr 02, 2006 1: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
Alvaro Urdaneta
 
Posts: 67
Joined: Wed Mar 29, 2006 10:54 pm
Location: Venezuela

Postby Alvaro Urdaneta » Sun Apr 02, 2006 2: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
Alvaro Urdaneta
 
Posts: 67
Joined: Wed Mar 29, 2006 10:54 pm
Location: Venezuela

Postby Antonio Linares » Sun Apr 02, 2006 2:18 pm

Alvaro,

> int 17h

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

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41314
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby Alvaro Urdaneta » Sun Apr 02, 2006 2:54 pm

Antonio,

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

Saludos
Alvaro Urdaneta
 
Posts: 67
Joined: Wed Mar 29, 2006 10:54 pm
Location: Venezuela

Postby Antonio Linares » Sun Apr 02, 2006 3:07 pm

Alvaro,

Tal vez esta pueda servir:
Code: Select all  Expand view
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:
Code: Select all  Expand view
#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
User avatar
Antonio Linares
Site Admin
 
Posts: 41314
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby AngelSalom » Sun Apr 02, 2006 3:49 pm

Fantástico maestro. Funcionó perfecto.
Angel Salom
Visionwin Software - https://www.visionwin.com
------------------------------------------------------------
fwh 19.05 - harbour 3.2 - bcc 7.4
User avatar
AngelSalom
 
Posts: 708
Joined: Fri Oct 07, 2005 7:38 am
Location: Benicarló (Castellón ) - España

Postby Alvaro Urdaneta » Sun Apr 02, 2006 4:22 pm

Antonio,

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

Saludos
Alvaro Urdaneta
 
Posts: 67
Joined: Wed Mar 29, 2006 10:54 pm
Location: Venezuela

Postby AngelSalom » Sun Apr 02, 2006 4: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
User avatar
AngelSalom
 
Posts: 708
Joined: Fri Oct 07, 2005 7:38 am
Location: Benicarló (Castellón ) - España

Postby Antonio Linares » Sun Apr 02, 2006 6:50 pm

Angel,

Es una función nueva en pruebas, probablemente haya que modificarla.
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41314
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby Olguiver » Tue Aug 08, 2006 2: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.
Olguiver
 
Posts: 16
Joined: Thu Jun 15, 2006 9:46 pm

Postby Ari » Wed Nov 08, 2006 4:01 pm

function Main()

local nStatus := PrnStatus( "LPT1: ")

MsgInfo( nStatus )

// sempre retorna 4096

return nil
User avatar
Ari
 
Posts: 224
Joined: Fri Feb 03, 2006 4:21 pm
Location: São Paulo, SP - Brazil

Postby karinha » Wed Nov 08, 2006 4: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
User avatar
karinha
 
Posts: 7213
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil


Return to FiveWin para Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 16 guests

cron