Fiz um teste rapido aqui com xharbour 1.0.0 e não funcionou....rochinha escreveu:Amiguinhos
Isto também funcionará?Como nunca usei estes recursos, pretendo usar.Código: Selecionar todos
wSt1 := PRINTstat("\\servidor\ImpressoraXYZ") wSt2 := PRINTREADY("\\servidor\ImpressoraXYZ")
PRINTREADY,PRINTSEND,... Testar Impressora On/Off Line
Moderador: Moderadores
- sygecom
- Administrador

- Mensagens: 7131
- Registrado em: 21 Jul 2006 10:12
- Localização: Alvorada-RS
- Contato:
Re: PRINTREADY,PRINTSEND,... Testar Impressora On/Off Line
Leonardo Machado
xHarbour.org + Hwgui + PostgreSql
xHarbour.org + Hwgui + PostgreSql
- rochinha
- Administrador

- Mensagens: 4664
- Registrado em: 18 Ago 2003 20:43
- Localização: São Paulo - Brasil
- Contato:
Re: PRINTREADY,PRINTSEND,... Testar Impressora On/Off Line
Amiguinhos
Obtive um resultado de teste de impressora com o seguinte codigo:
Obtive um resultado de teste de impressora com o seguinte codigo:
Código: Selecionar todos
#include "fivewin.ch"
#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 ) // So teste
// Retornou FALSO porque nao tenho impressora fisica conectada
MsgRun( isprint( "LPT1" ), "LPT1 Printer Status", {|| SysWait(3) } )
// Retornou OK porque uso este driver virtual
MsgRun( isprint( "PDF4U Adobe PDF Creator" ), "PDF4U Printer Status", {|| SysWait(3) } )
// Retornou FALSO pois nao reconheceu pelo nome amigavel do mapeamento
MsgRun( isprint( "HP Deskjet D2300 series" ), "HP Printer Status", {|| SysWait(3) } )
// Retornou OK porque acessou a impressora diretamente
MsgRun( isprint( "\\Iasminmrocha-pc\HP Deskjet D2300 series" ), "HP Printer Status", {|| SysWait(3) } )
return .t.
function IsPrint( QuePrinter )
LOCAL nStatus
DEFAULT QuePrinter := "LPT1:"
nStatus := PrnStatus( QuePrinter )
if nStatus < 1 ; return "Impressora OK"
elseif nStatus = 1 ; return "Impressora Pausada"
elseif nStatus = 2 ; return "Impressora com Erro"
elseif nStatus = 4 ; return "Impressora Deletando"
elseif nStatus = 8 ; return "Impressora em Modo Bandeja"
elseif nStatus = 16 ; return "Impressora Sem Papel"
elseif nStatus = 32 ; return "Impressora em Modo Manual"
elseif nStatus = 64 ; return "Impressora com Problema no Papel"
elseif nStatus = 128 ; return "Impressora OffLine"
elseif nStatus = 256 ; return "Impressora com IO Ativo"
elseif nStatus = 512 ; return "Impressora Ocupada"
elseif nStatus = 1024 ; return "Impressora Imprimindo"
elseif nStatus = 2048 ; return "Impressora Memoria Lotada"
elseif nStatus = 4096 ; return "Impressora Nao Instalada"
elseif nStatus = 8192 ; return "Impressora Aguardando"
elseif nStatus = 16384 ; return "Impressora Processando"
elseif nStatus = 32768 ; return "Impressora Inicializando"
elseif nStatus = 65536 ; return "Impressora em Atencao"
elseif nStatus = 131072 ; return "Impressora Toner Baixo"
elseif nStatus = 262144 ; return "Impressora Sem Toner"
elseif nStatus = 524288 ; return "Impressora PAGE_PUNT"
elseif nStatus = 1048576 ; return "Impressora Intervencao do Usuario"
elseif nStatus = 2097152 ; return "Impressora Sem Memoria"
elseif nStatus = 4194304 ; return "Impressora Tampa Aberta"
elseif nStatus = 8388608 ; return "Impressora Servidor Desconhecido"
elseif nStatus = 16777217 ; return "Impressora POWER_SAVE"
endif
OPS! LINK QUEBRADO? Veja ESTE TOPICO antes e caso não encontre ENVIE seu email com link do tópico para [url=mailto://fivolution@hotmail.com]fivolution@hotmail.com[/url]. Agradecido.
@braços : ? )
A justiça divina tarda mas não falha, enquanto que a justiça dos homens falha porque tarda.
@braços : ? )
A justiça divina tarda mas não falha, enquanto que a justiça dos homens falha porque tarda.
-
marcos.gurupi
- Usuário Nível 4

- Mensagens: 939
- Registrado em: 06 Jul 2004 11:53
- Localização: Gurupi-TO
Re: PRINTREADY,PRINTSEND,... Testar Impressora On/Off Line
Aqui deu erro em PRNSTATUS(). Faz parte de alguma LIB ou eh uma funcao sua?
Marcos Roberto
Marcos Roberto
Marcos Roberto
NetService Software
NetService Software
- rochinha
- Administrador

- Mensagens: 4664
- Registrado em: 18 Ago 2003 20:43
- Localização: São Paulo - Brasil
- Contato:
Re: PRINTREADY,PRINTSEND,... Testar Impressora On/Off Line
Amiguinho
Ela faz parte da WINAPI do Fivewin.
printdc.c
Ela faz parte da WINAPI do Fivewin.
printdc.c
Código: Selecionar todos
#define ENDDOC _ENDDOC
#define DRAFTMODE _DRAFTMODE
#define STARTDOC _STARTDOC
#include <WinTen.h>
#include <Windows.h>
#ifndef __FLAT__
#include <Print.h>
#endif
#include <CommDlg.h>
#include <ClipApi.h>
typedef struct
{
WORD vlen;
BYTE data[10];
} ESCDATA;
BOOL IsWin95( void );
static BOOL CALLBACK PrnSetupHkProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPar);
static void SendFile(HDC, LPSTR);
typedef struct
{
WORD wSize;
BYTE bData[2];
} PASSTHROUGHSTRUCT, FAR *LPPTS;
extern HINSTANCE GetInstance( void );
static far PRINTDLG pd;
static far BOOL bInit = FALSE;
static far RECT rtMargin = { 2500, 2500, 2500, 2500 };
//----------------------------------------------------------------------------//
static void PrinterInit( void )
{
if( ! bInit )
{
bInit = TRUE;
_bset( ( char * ) &pd, 0, sizeof( PRINTDLG ) );
pd.lStructSize = sizeof( PRINTDLG );
pd.hwndOwner = GetActiveWindow();
pd.Flags = PD_RETURNDEFAULT ;
pd.nFromPage = 1;
pd.nToPage = 1;
pd.nMinPage = 1;
pd.nMaxPage = 65535;
pd.nCopies = 1;
PrintDlg( &pd );
}
}
//----------------------------------------------------------------------------//
#ifdef __HARBOUR__
CLIPPER PRINTERINIT( PARAMS ) //
#else
CLIPPER PRINTERINI( PARAMS ) //T
#endif
{
bInit = FALSE;
}
//----------------------------------------------------------------------------//
CLIPPER PRINTEREND( PARAMS )
{
if( bInit )
{
if( pd.hDevMode != NULL )
{
GlobalFree( pd.hDevMode );
pd.hDevMode = NULL;
}
if( pd.hDevNames != NULL )
{
GlobalFree( pd.hDevNames );
pd.hDevNames = NULL;
}
bInit = FALSE;
}
_ret();
}
//----------------------------------------------------------------------------//
#ifdef __FLAT__
CLIPPER GETPRINTDC( PARAMS ) // ( hWndOwner, bSel, bPage ) --> hDC
{
BOOL bSel = _parl( 2 );
BOOL bPage = _parl( 3 );
PrinterInit();
pd.hwndOwner = ( HWND ) _parnl( 1 );
pd.Flags = PD_ALLPAGES | PD_RETURNDC | PD_HIDEPRINTTOFILE;
pd.Flags &= bSel ? ~PD_NOSELECTION : ~PD_SELECTION;
pd.Flags |= bSel ? PD_SELECTION : PD_NOSELECTION;
if( bSel || !bPage )
pd.nFromPage = pd.nToPage = 1;
else
pd.Flags |= bPage ? PD_PAGENUMS : 0;
_retnl( ( LONG ) ( PrintDlg( &pd ) ? pd.hDC : 0 ) );
}
#else
CLIPPER GETPRINTDC( PARAMS ) // ( hWndOwner ) --> hDC
{
PrinterInit();
pd.hwndOwner = ( HWND ) _parnl( 1 );
pd.Flags = PD_RETURNDC | PD_USEDEVMODECOPIES |
PD_HIDEPRINTTOFILE | PD_NOSELECTION ;
_retnl( ( LONG ) ( PrintDlg( &pd ) ? pd.hDC : 0 ) );
}
#endif
//----------------------------------------------------------------------------//
#define WF_WINNT 0x4000
#ifdef __HARBOUR__
CLIPPER PRINTERSETUP( PARAMS ) // ( hWndOwner ) --> nil
#else
CLIPPER PRINTERSET( PARAMS ) // up( hWndOwner ) --> nil
#endif
{
PrinterInit();
pd.hwndOwner = IF( PCOUNT() == 0, GetActiveWindow(), ( HWND ) _parnl( 1 ) );
pd.Flags = PD_PRINTSETUP | PD_USEDEVMODECOPIES;
#ifndef __FLAT__
if( IsWin95() || GetWinFlags() & WF_WINNT )
{
#endif
pd.Flags = pd.Flags | PD_ENABLESETUPHOOK;
#ifndef __FLAT__
pd.lpfnSetupHook = PrnSetupHkProc;
#else
pd.lpfnSetupHook = ( LPPRINTHOOKPROC ) PrnSetupHkProc;
#endif
#ifndef __FLAT__
}
#endif
_retnl( ( LONG ) ( PrintDlg( &pd ) ? pd.hDC : 0 ) );
}
//----------------------------------------------------------------------------//
static BOOL CALLBACK PrnSetupHkProc(HWND hDlg,
UINT uMsg,
WPARAM wParam,
LPARAM lPar)
{
return FALSE;
}
//----------------------------------------------------------------------------//
#ifdef __FLAT__
CLIPPER PAGESETUP( PARAMS )
{
LPDEVNAMES lpDevNames;
LPDEVMODE lpDevMode;
PAGESETUPDLG psd;
rtMargin.top = IF( ISNUM( 2 ), _parni( 2 ), rtMargin.top );
rtMargin.left = IF( ISNUM( 3 ), _parni( 3 ), rtMargin.left );
rtMargin.right = IF( ISNUM( 4 ), _parni( 4 ), rtMargin.right );
rtMargin.bottom = IF( ISNUM( 5 ), _parni( 5 ), rtMargin.bottom );
PrinterInit();
lpDevNames = ( LPDEVNAMES ) GlobalLock( pd.hDevNames );
lpDevMode = ( LPDEVMODE ) GlobalLock( pd.hDevMode );
_bset( ( char * ) &psd, 0, sizeof( PAGESETUPDLG ) );
psd.lStructSize = sizeof( PAGESETUPDLG );
psd.hwndOwner = IF( PCOUNT() == 0, GetActiveWindow(), ( HWND ) _parnl( 1 ) );
psd.hDevNames = lpDevNames;
psd.hDevMode = lpDevMode;
psd.rtMargin = rtMargin;
#ifndef __FLAT__
if( IsWin95() || GetWinFlags() & WF_WINNT )
{
#endif
psd.Flags = PSD_MARGINS | PSD_INHUNDREDTHSOFMILLIMETERS |
PSD_ENABLEPAGESETUPHOOK;
#ifndef __FLAT__
psd.lpfnPageSetupHook = PrnSetupHkProc;
#else
psd.lpfnPageSetupHook = ( LPPAGESETUPHOOK ) PrnSetupHkProc;
#endif
#ifndef __FLAT__
}
#endif
if( PageSetupDlg( &psd ) );
{
pd.hDevNames = psd.hDevNames;
pd.hDevMode = psd.hDevMode;
rtMargin = psd.rtMargin;
}
GlobalUnlock( pd.hDevNames );
GlobalUnlock( pd.hDevMode );
}
#endif
//----------------------------------------------------------------------------//
#ifdef __HARBOUR__
CLIPPER PAGEGETMARGINS( PARAMS )
#else
CLIPPER PAGEGETMAR( PARAMS ) // GINS()
#endif
{
_reta( 4 );
#ifdef __XPP__
#define _storni( x, y, z ) STORNI( x, params, y, z )
#endif
_storni( rtMargin.top, -1, 1 );
_storni( rtMargin.left, -1, 2 );
_storni( rtMargin.right, -1, 3 );
_storni( rtMargin.bottom, -1, 4 );
}
//----------------------------------------------------------------------------//
#undef STARTDOC
CLIPPER STARTDOC( PARAMS )
{
DOCINFO info;
char szDocName[ 32 ];
int iLen = MIN( 31, _parclen( 2 ) );
_bcopy( szDocName, _parc( 2 ), iLen );
szDocName[ iLen ] = 0;
info.cbSize = sizeof( DOCINFO );
info.lpszDocName = IF( ISCHAR( 2 ), szDocName, "" );
info.lpszOutput = IF( ISCHAR( 3 ), _parc( 3 ), 0 );
#ifdef __FLAT__
info.lpszDatatype = 0;
info.fwType = 0;
#endif
_retni( StartDoc( ( HDC ) _parnl( 1 ), // hDC printer device
&info ) );
}
//----------------------------------------------------------------------------//
#undef ENDDOC
CLIPPER ENDDOC( PARAMS )
{
_retnl( ( LONG ) EndDoc( ( HDC ) _parnl( 1 ) ) ); // hDC printer device
}
//----------------------------------------------------------------------------//
CLIPPER STARTPAGE( PARAMS )
{
_retnl( ( LONG ) StartPage( ( HDC ) _parnl( 1 ) ) ); // hDC printer device
}
//----------------------------------------------------------------------------//
CLIPPER ENDPAGE( PARAMS )
{
_retnl( ( LONG ) EndPage( ( HDC ) _parnl( 1 ) ) ); // hDC printer device
}
//----------------------------------------------------------------------------//
CLIPPER ESCAPE( PARAMS ) // ( hDC, nEscape, cInput, @cOutPut ) --> nReturn
{
BYTE * pBuffer = ( BYTE * ) IF( PCOUNT() == 4, _xgrab( _parclen( 3 ) ), 0 );
_retni( Escape( ( HDC ) _parnl( 1 ), _parni( 2 ), _parclen( 3 ), _parc( 3 ),
pBuffer ) );
if( pBuffer )
{
_storclen( ( char * ) pBuffer, _parclen( 3 ), 4 );
_xfree( pBuffer );
}
}
//----------------------------------------------------------------------------//
#ifdef __HARBOUR__
CLIPPER GETPRINTDEFAULT( PARAMS ) // ( hWndOwner ) --> nil
#else
CLIPPER GETPRINTDE( PARAMS ) // FAULT( hWndOwner ) --> nil
#endif
{
LPDEVNAMES lpDevNames;
LPDEVMODE lpDevMode;
PrinterInit();
if( pd.hDevNames )
{
lpDevNames = (LPDEVNAMES) GlobalLock( pd.hDevNames );
lpDevMode = (LPDEVMODE) GlobalLock( pd.hDevMode );
_retnl( ( LONG ) CreateDC( ( LPSTR ) lpDevNames + lpDevNames->wDriverOffset,
( LPSTR ) lpDevNames + lpDevNames->wDeviceOffset,
( LPSTR ) lpDevNames + lpDevNames->wOutputOffset,
lpDevMode ) );
GlobalUnlock( pd.hDevNames );
GlobalUnlock( pd.hDevMode );
}
else
_retnl( 0 );
}
//----------------------------------------------------------------------------//
CLIPPER PRNOFFSET( PARAMS ) // ( hDC) --> aPoint
{
POINT pt;
pt.y = 0;
pt.x = 0;
Escape( ( HDC ) _parnl( 1 ),
GETPRINTINGOFFSET,
NULL, NULL, ( LPPOINT ) &pt ) ;
_reta( 2 );
#ifdef __FLAT__
#ifndef __HARBOUR__
#define _storni( x, y, z ) STORNI( x, params, y, z )
#endif
#endif
_storni( pt.y, -1, 2 );
_storni( pt.x, -1, 1 );
}
//----------------------------------------------------------------------------//
#ifdef __FLAT__
#ifdef __HARBOUR__
CLIPPER PRNSETCOLLATE( PARAMS ) // ( hDC ) --> lSuccess
#else
CLIPPER PRNSETCOLL( PARAMS ) // ATE( hDC ) --> lSuccess
#endif
{
LPDEVMODE lpDevMode;
PrinterInit();
lpDevMode = (LPDEVMODE) GlobalLock( pd.hDevMode );
if ( _parl( 1 ) )
lpDevMode->dmCollate = DMCOLLATE_TRUE;
else
lpDevMode->dmCollate = DMCOLLATE_FALSE;
GlobalUnlock( pd.hDevMode );
_retl( TRUE );
}
#endif
//----------------------------------------------------------------------------//
CLIPPER RESETDC( PARAMS ) // hDC --> lSuccess
{
LPDEVMODE lpDevMode;
PrinterInit();
lpDevMode = ( LPDEVMODE ) GlobalLock( pd.hDevMode );
_retl( ( BOOL ) ResetDC( ( HDC ) _parnl( 1 ), lpDevMode ) );
GlobalUnlock( pd.hDevMode );
}
//----------------------------------------------------------------------------//
CLIPPER PRNGETSIZE( PARAMS ) // ( hDC) --> aPoint
{
POINT pt;
pt.y = 0;
pt.x = 0;
Escape( ( HDC ) _parnl( 1 ),
GETPHYSPAGESIZE,
NULL, NULL, ( LPPOINT ) &pt ) ;
_reta( 2 );
_storni( pt.y, -1, 2 );
_storni( pt.x, -1, 1 );
}
//----------------------------------------------------------------------------//
#ifdef __HARBOUR__
CLIPPER PRNLANDSCAPE( PARAMS ) // (hDC) --> lSuccess
#else
CLIPPER PRNLANDSCA( PARAMS ) // PE(hDC) --> lSuccess
#endif
{
LPDEVMODE lpDevMode;
PrinterInit();
lpDevMode = (LPDEVMODE) GlobalLock( pd.hDevMode );
lpDevMode->dmOrientation = DMORIENT_LANDSCAPE;
GlobalUnlock( pd.hDevMode );
_retl( TRUE );
}
//----------------------------------------------------------------------------//
CLIPPER PRNDUPLEX( PARAMS ) // ( nValue ) --> nOldValue
{
LPDEVMODE lpDevMode;
int dmDuplex;
PrinterInit();
lpDevMode = (LPDEVMODE) GlobalLock( pd.hDevMode );
dmDuplex = lpDevMode->dmDuplex;
if( PCOUNT() > 0 )
lpDevMode->dmDuplex = _parni( 1 );
_retni( dmDuplex );
GlobalUnlock( pd.hDevMode );
}
//----------------------------------------------------------------------------//
CLIPPER PRNSETSIZE( PARAMS )
{
LPDEVMODE lpDevMode;
PrinterInit();
lpDevMode = (LPDEVMODE) GlobalLock( pd.hDevMode );
lpDevMode->dmFields = lpDevMode->dmFields | DM_PAPERSIZE |
DM_PAPERLENGTH | DM_PAPERWIDTH;
lpDevMode->dmPaperSize = DMPAPER_USER;
lpDevMode->dmPaperWidth = _parnl( 1 );
lpDevMode->dmPaperLength = _parnl( 2 );
GlobalUnlock( pd.hDevMode );
}
//----------------------------------------------------------------------------//
#ifdef __HARBOUR__
CLIPPER PRNPORTRAIT( PARAMS ) // () --> lSuccess
#else
CLIPPER PRNPORTRAI( PARAMS ) // T() --> lSuccess
#endif
{
LPDEVMODE lpDevMode;
PrinterInit();
lpDevMode = (LPDEVMODE) GlobalLock( pd.hDevMode );
lpDevMode->dmOrientation = DMORIENT_PORTRAIT;
GlobalUnlock( pd.hDevMode );
_retl( TRUE );
}
//----------------------------------------------------------------------------//
#ifdef __HARBOUR__
CLIPPER PRNGETORIENTATION( PARAMS ) // () --> nOldOrient
#else
CLIPPER PRNGETORIE( PARAMS ) // NTATION() --> nOldOrient
#endif
{
LPDEVMODE lpDevMode;
PrinterInit();
lpDevMode = (LPDEVMODE) GlobalLock( pd.hDevMode );
_retni( lpDevMode->dmOrientation );
GlobalUnlock( pd.hDevMode );
}
//----------------------------------------------------------------------------//
#ifdef __HARBOUR__
CLIPPER PRNSETCOPIES( PARAMS ) // ( nCopies ) --> lSuccess
#else
CLIPPER PRNSETCOPI( PARAMS ) // ES( nCopies ) --> lSuccess
#endif
{
LPDEVMODE lpDevMode;
PrinterInit();
lpDevMode = (LPDEVMODE) GlobalLock( pd.hDevMode );
lpDevMode->dmCopies = _parni( 1 );
if( PCOUNT() == 2 ) // Compatibility with previous syntax!
lpDevMode->dmCopies = _parni( 2 );
GlobalUnlock( pd.hDevMode );
_retl( TRUE );
}
//----------------------------------------------------------------------------//
#ifdef __HARBOUR__
CLIPPER PRNGETPAGES( PARAMS ) // { nFrom, nTo }
#else
CLIPPER PRNGETPAGE( PARAMS ) // S() --> {nFrom, nTo}
#endif
{
PrinterInit();
_reta( 2 );
#ifdef __XPP__
#define _storni( x, y, z ) STORNI( x, params, y, z )
#endif
_storni( pd.nFromPage, -1, 1 );
_storni( pd.nToPage, -1, 2 );
}
//----------------------------------------------------------------------------//
#ifdef __HARBOUR__
CLIPPER PRNGETCOPIES( PARAMS ) // --> nCopies
#else
CLIPPER PRNGETCOPI( PARAMS ) // ES() --> nCopies
#endif
{
LPDEVMODE lpDevMode;
PrinterInit();
lpDevMode = (LPDEVMODE) GlobalLock( pd.hDevMode );
_retni( lpDevMode->dmCopies);
GlobalUnlock( pd.hDevMode );
}
//----------------------------------------------------------------------------//
#ifdef __HARBOUR__
CLIPPER PRNGETPAGNUMS( PARAMS ) // --> lPageNums
#else
CLIPPER PRNGETPAGN( PARAMS ) // UMS() --> lPageNums
#endif
{
PrinterInit();
_retl( pd.Flags & PD_PAGENUMS );
}
//----------------------------------------------------------------------------//
#ifdef __HARBOUR__
CLIPPER PRNGETSELECTION( PARAMS ) // --> lSelection
#else
CLIPPER PRNGETSELE( PARAMS ) // CTION() --> lSelection
#endif
{
PrinterInit();
_retl( pd.Flags & PD_SELECTION );
}
//----------------------------------------------------------------------------//
#ifdef __FLAT__
#ifdef __HARBOUR__
CLIPPER PRNGETCOLLATE( PARAMS ) // --> lCollate
#else
CLIPPER PRNGETCOLL( PARAMS ) // ATE() --> lCollate
#endif
{
LPDEVMODE lpDevMode;
PrinterInit();
lpDevMode = ( LPDEVMODE ) GlobalLock( pd.hDevMode );
_retl( lpDevMode->dmCollate );
GlobalUnlock( pd.hDevMode );
}
#endif
//----------------------------------------------------------------------------//
CLIPPER PRINTERESC( PARAMS ) // ( hDC, cText ) --> lSuccess
{
ESCDATA Data;
Data.vlen = _parclen(2);
_bcopy( ( char * ) Data.data, _parc(2), _parclen(2) );
_retni( Escape( ( HDC ) _parni( 1 ), PASSTHROUGH, NULL, (LPSTR) &Data, NULL ) );
}
//----------------------------------------------------------------------------//
CLIPPER PRNGETNAME( PARAMS ) // () --> cPrinter
{
LPDEVNAMES lpDevNames;
PrinterInit();
lpDevNames = (LPDEVNAMES) GlobalLock( pd.hDevNames );
_retc( ( LPSTR ) lpDevNames + lpDevNames->wDeviceOffset );
GlobalUnlock( pd.hDevNames );
}
//----------------------------------------------------------------------------//
CLIPPER PRNGETPORT( PARAMS ) // () --> cPort
{
LPDEVNAMES lpDevNames;
PrinterInit();
lpDevNames = (LPDEVNAMES) GlobalLock( pd.hDevNames );
_retc( ( LPSTR ) lpDevNames + lpDevNames->wOutputOffset );
GlobalUnlock( pd.hDevNames );
}
//----------------------------------------------------------------------------//
#ifdef __HARBOUR__
CLIPPER PRNGETDRIVE( PARAMS ) // () --> cDriver
#else
CLIPPER PRNGETDRIV( PARAMS ) // ER () --> cDriver
#endif
{
LPDEVNAMES lpDevNames;
PrinterInit();
lpDevNames = (LPDEVNAMES) GlobalLock( pd.hDevNames );
_retc( ( LPSTR ) lpDevNames + lpDevNames->wDriverOffset );
GlobalUnlock( pd.hDevNames );
}
//----------------------------------------------------------------------------//
CLIPPER PRNSETPAGE( PARAMS )
{
LPDEVMODE lpDevMode;
PrinterInit();
lpDevMode = (LPDEVMODE) GlobalLock( pd.hDevMode );
lpDevMode->dmPaperSize = _parni( 1 );
GlobalUnlock( pd.hDevMode );
}
//----------------------------------------------------------------------------//
#ifdef __HARBOUR__
CLIPPER PRNBINSOURCE( PARAMS ) //( nBin )
#else
CLIPPER PRNBINSOUR( PARAMS ) //CE( nBin )
#endif
{
LPDEVMODE lpDevMode;
PrinterInit();
lpDevMode = (LPDEVMODE) GlobalLock( pd.hDevMode );
_retni( ( LONG ) lpDevMode->dmDefaultSource );
if ( PCOUNT() > 0 )
{
lpDevMode->dmDefaultSource = _parni( 1 );
}
GlobalUnlock( pd.hDevMode );
}
//----------------------------------------------------------------------------//
#ifdef __HARBOUR__
CLIPPER IMPORTRAWFILE( PARAMS ) // (hDC, cFile) --> lMode
#else
CLIPPER IMPORTRAWF( PARAMS ) // ile(hDC, cFile) --> lMode
#endif
{
int iEsc;
iEsc = PASSTHROUGH;
if ( Escape( ( HDC ) _parnl( 1 ), QUERYESCSUPPORT, sizeof(int), (LPSTR)&iEsc, NULL))
{
iEsc = EPSPRINTING;
if (Escape( ( HDC ) _parnl( 1 ), QUERYESCSUPPORT, sizeof(int), (LPSTR)&iEsc, NULL))
{
iEsc = 1;
Escape( ( HDC ) _parnl( 1 ), EPSPRINTING, sizeof(int), (LPSTR)&iEsc, NULL);
}
#ifndef __FLAT__
SendFile( ( HDC ) _parnl( 1 ), (LPSTR) _parc( 2 ));
#endif
}
}
//----------------------------------------------------------------------------//
#define BUFSIZE 2048
#ifndef __FLAT__
static void SendFile(HDC hPrnDC, LPSTR szFile)
{
static LPPTS lpPTS=NULL; // Pointer to PASSTHROUGHSTRUCT
OFSTRUCT ofs;
HFILE hFile;
hFile = OpenFile((LPSTR) szFile, &ofs, OF_READ);
if (hFile == HFILE_ERROR)
{
_retni(0);
return;
}
if (!lpPTS &&
!(lpPTS = (LPPTS)GlobalLock(GlobalAlloc(GPTR, sizeof(WORD) + BUFSIZE))))
{
_retni(0);
return;
}
do {
lpPTS->wSize = _lread(hFile, lpPTS->bData, BUFSIZE);
Escape(hPrnDC, PASSTHROUGH, NULL, (LPSTR)lpPTS, NULL);
}
while ((lpPTS->wSize == BUFSIZE));
_lclose(hFile);
_retni(1);
}
#endif
//----------------------------------------------------------------------------//
#undef DRAFTMODE
CLIPPER DRAFTMODE( PARAMS ) // lMode
{
LPDEVMODE lpDevMode;
PrinterInit();
lpDevMode = (LPDEVMODE) GlobalLock( pd.hDevMode );
lpDevMode->dmFields = lpDevMode->dmFields | DM_PRINTQUALITY;
lpDevMode->dmPrintQuality = IF( _parl( 1 ), -1, -4 );
GlobalUnlock( pd.hDevMode );
}
//----------------------------------------------------------------------------//
CLIPPER SPOOLFILE( PARAMS )
{
#ifndef __FLAT__
_retni( SpoolFile( _parc( 1 ), _parc( 2 ), _parc( 3 ), _parc( 4 ) ) );
#endif
}
//----------------------------------------------------------------------------//
CLIPPER devMODE( PARAMS ) // lMode
{
/*
LPDEVMODE lpDevMode;
PrinterInit();
lpDevMode = (LPDEVMODE) GlobalLock( pd.hDevMode );
if( PCOUNT() )
{
lpDevMode->dmDeviceName = _parc( 1, 1 );
lpDevMode->dmSpecVersion = _parni( 1, 2 );
lpDevMode->dm...
}
_reta( 26 );
_storc( lpDevMode->dmDeviceName, -1, 1 );
_storni( lpDevMode->dmSpecVersion, -1, 2 );
_storni( lpDevMode->dmDriverVersion, -1, 3 );
_stornl( lpDevMode->dmSpecVersion, -1, 2 ); // use stornl for 4 bytes
BCHAR dmDeviceName[CCHDEVICENAME];
WORD dmSpecVersion;
WORD dmDriverVersion;
WORD dmSize;
WORD dmDriverExtra;
DWORD dmFields;
short dmOrientation;
short dmPaperSize;
short dmPaperLength;
short dmPaperWidth;
short dmScale;
short dmCopies;
short dmDefaultSource;
short dmPrintQuality;
short dmColor;
short dmDuplex;
short dmYResolution;
short dmTTOption;
short dmCollate;
BCHAR dmFormName[CCHFORMNAME];
WORD dmLogPixels;
DWORD dmBitsPerPel;
DWORD dmPelsWidth;
DWORD dmPelsHeight;
DWORD dmDisplayFlags;
DWORD dmDisplayFrequency;
GlobalUnlock( pd.hDevMode );
*/
}
//----------------------------------------------------------------------------//
CLIPPER COMDLGXERR( PARAMS ) // () --> nError
{
_retnl( CommDlgExtendedError() );
}
//----------------------------------------------------------------------------//
#ifdef __HARBOUR__
static int CALLBACK EnumFamCallBack( LOGFONT FAR * lpnlf,
TEXTMETRIC FAR * lpntm, int FontType, LPARAM lParam )
{
#ifndef __FLAT__
_putsym( _SymEVAL );
_xpushm( ( PCLIPVAR ) lParam );
_reta( 14 ); // LOGFONT elements
_stornl( lpnlf->lfHeight, -1, 1 );
_stornl( lpnlf->lfWidth, -1, 2 );
_stornl( lpnlf->lfEscapement, -1, 3 );
_stornl( lpnlf->lfOrientation, -1, 4 );
_stornl( lpnlf->lfWeight, -1, 5 );
_stornl( lpnlf->lfItalic, -1, 6 );
_stornl( lpnlf->lfUnderline, -1, 7 );
_stornl( lpnlf->lfStrikeOut, -1, 8 );
_stornl( lpnlf->lfCharSet, -1, 9 );
_stornl( lpnlf->lfOutPrecision, -1, 10 );
_stornl( lpnlf->lfClipPrecision, -1, 11 );
_stornl( lpnlf->lfQuality, -1, 12 );
_stornl( lpnlf->lfPitchAndFamily, -1, 13 );
_storc( lpnlf->lfFaceName, -1, 14 );
_xpushm( _eval );
_reta( 20 ); // TEXTMETRICS elements
_stornl( lpntm->tmHeight, -1, 1 );
_stornl( lpntm->tmAscent, -1, 2 );
_stornl( lpntm->tmDescent, -1, 3 );
_stornl( lpntm->tmInternalLeading, -1, 4 );
_stornl( lpntm->tmExternalLeading, -1, 5 );
_stornl( lpntm->tmAveCharWidth, -1, 6 );
_stornl( lpntm->tmMaxCharWidth, -1, 7 );
_stornl( lpntm->tmWeight, -1, 8 );
_stornl( lpntm->tmItalic, -1, 9 );
_stornl( lpntm->tmUnderlined, -1, 10 );
_stornl( lpntm->tmStruckOut, -1, 11 );
_stornl( lpntm->tmFirstChar, -1, 12 );
_stornl( lpntm->tmLastChar, -1, 13 );
_stornl( lpntm->tmDefaultChar, -1, 14 );
_stornl( lpntm->tmBreakChar, -1, 15 );
_stornl( lpntm->tmPitchAndFamily, -1, 16 );
_stornl( lpntm->tmCharSet, -1, 17 );
_stornl( lpntm->tmOverhang, -1, 18 );
_stornl( lpntm->tmDigitizedAspectX, -1, 19 );
_stornl( lpntm->tmDigitizedAspectY, -1, 20 );
_xpushm( _eval );
_PutLN( FontType );
_xEval( 3 );
return _parnl( -1 );
#else
return 0;
#endif
}
#ifdef __HARBOUR__
CLIPPER ENUMFONTFAMILIES( PARAMS ) // ( hDC, cFamily, bCallBack )
#else
CLIPPER ENUMFONTFA( PARAMS ) // MILIES( hDC, cFamily, bCallBack )
#endif
{
FONTENUMPROC lpEnumFamCallBack = ( FONTENUMPROC )
MakeProcInstance( ( FARPROC ) EnumFamCallBack, GetInstance() );
#ifndef __FLAT__
LPVOID bCallBack = ( LPVOID ) _param( 3, 0xFFFF );
#else
LPARAM bCallBack;
#endif
EnumFontFamilies( ( HDC ) _parnl( 1 ),
IF( ISCHAR( 2 ), _parc( 2 ), NULL ),
lpEnumFamCallBack,
bCallBack ); // ( LPARAM ) aFontCount );
FreeProcInstance( ( FARPROC ) lpEnumFamCallBack );
}
#endif
//----------------------------------------------------------------------------//
#ifdef __FLAT__
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 );
}
#endif
//----------------------------------------------------------------------------//
OPS! LINK QUEBRADO? Veja ESTE TOPICO antes e caso não encontre ENVIE seu email com link do tópico para [url=mailto://fivolution@hotmail.com]fivolution@hotmail.com[/url]. Agradecido.
@braços : ? )
A justiça divina tarda mas não falha, enquanto que a justiça dos homens falha porque tarda.
@braços : ? )
A justiça divina tarda mas não falha, enquanto que a justiça dos homens falha porque tarda.
-
microvolution
- Usuário Nível 5

- Mensagens: 1231
- Registrado em: 02 Set 2011 22:17
- Contato:
PRINTREADY,PRINTSEND,... Testar Impressora On/Off Line
bom dia mais uma vez nobre professor Rochinha!rochinha escreveu:Ela faz parte da WINAPI do Fivewin.
Agora achei donde vem essa sua função PRNSTATUS()... tem ela pro harbour ou qual o nome da mesma no harbour?
Grato,
MICROVOLUTION - 16 anos Evoluindo Com Você!
Você já leu a Bíblia hoje?
João 3:16 - Porque Deus amou ao mundo de tal maneira que deu seu Único Filho para que todo aquele que nEle crê não pereça mas tenha a Vida Eterna!
MICROVOLUTION - 16 anos Evoluindo Com Você!
Você já leu a Bíblia hoje?
João 3:16 - Porque Deus amou ao mundo de tal maneira que deu seu Único Filho para que todo aquele que nEle crê não pereça mas tenha a Vida Eterna!
- JoséQuintas
- Administrador

- Mensagens: 20267
- Registrado em: 26 Fev 2007 11:59
- Localização: São Paulo-SP
PRINTREADY,PRINTSEND,... Testar Impressora On/Off Line
No Harbour as funções de API são centralizadas em HBWIN.
Se não encontradas, é pesquisar na Microsoft, porque fazem parte do Windows.
Em todo caso, pode usar um recurso do hbmk2 pra pesquisar nomes de funções no Harbour:
hbmk2 -find print
Se não encontradas, é pesquisar na Microsoft, porque fazem parte do Windows.
Em todo caso, pode usar um recurso do hbmk2 pra pesquisar nomes de funções no Harbour:
hbmk2 -find print
...
hbwin.hbc (installed):
win_PrintDataRaw()
win_PrintDlgDC()
win_printerExists()
win_printerGetDefault()
win_printerList()
win_printerPortToName()
win_printerSetDefault()
win_printerStatus()
win_PrintFileRaw()
...
José M. C. Quintas
Harbour 3.2, mingw, gtwvg mt, fivewin 25.04, multithread, dbfcdx, MySQL, ADOClass, PDFClass, SefazClass, (hwgui mt), (hmg3), (hmg extended), (oohg), PNotepad, ASP, stored procedure, stored function, Linux (Flagship/harbour 3.2)
"The world is full of kings and queens, who blind our eyes and steal our dreams Its Heaven and Hell"
https://github.com/JoseQuintas/
Harbour 3.2, mingw, gtwvg mt, fivewin 25.04, multithread, dbfcdx, MySQL, ADOClass, PDFClass, SefazClass, (hwgui mt), (hmg3), (hmg extended), (oohg), PNotepad, ASP, stored procedure, stored function, Linux (Flagship/harbour 3.2)
"The world is full of kings and queens, who blind our eyes and steal our dreams Its Heaven and Hell"
https://github.com/JoseQuintas/
- JoséQuintas
- Administrador

- Mensagens: 20267
- Registrado em: 26 Fev 2007 11:59
- Localização: São Paulo-SP
PRINTREADY,PRINTSEND,... Testar Impressora On/Off Line
Se quiser olhar na Microsoft...
Talvez entenda porque é mais fácil usar uma LIB pronta.
https://support.microsoft.com/en-us/kb/160129
Talvez entenda porque é mais fácil usar uma LIB pronta.
https://support.microsoft.com/en-us/kb/160129
José M. C. Quintas
Harbour 3.2, mingw, gtwvg mt, fivewin 25.04, multithread, dbfcdx, MySQL, ADOClass, PDFClass, SefazClass, (hwgui mt), (hmg3), (hmg extended), (oohg), PNotepad, ASP, stored procedure, stored function, Linux (Flagship/harbour 3.2)
"The world is full of kings and queens, who blind our eyes and steal our dreams Its Heaven and Hell"
https://github.com/JoseQuintas/
Harbour 3.2, mingw, gtwvg mt, fivewin 25.04, multithread, dbfcdx, MySQL, ADOClass, PDFClass, SefazClass, (hwgui mt), (hmg3), (hmg extended), (oohg), PNotepad, ASP, stored procedure, stored function, Linux (Flagship/harbour 3.2)
"The world is full of kings and queens, who blind our eyes and steal our dreams Its Heaven and Hell"
https://github.com/JoseQuintas/
-
microvolution
- Usuário Nível 5

- Mensagens: 1231
- Registrado em: 02 Set 2011 22:17
- Contato:
PRINTREADY,PRINTSEND,... Testar Impressora On/Off Line
estou sempre em construção...
para pesquisar eu usar o F3 do windows e se não achasse usava o próprio F3 do editor de textos NotePad++ em procurar todos os arquivos e pastas (selecionada)... que também aprendi contigo professor!
vou testar agora se funciona o STATUS 128, que é a impressora conectada à lptx mas com cabo desconectado ou ela desligada ou cabo com defeito...
é o que preciso para fazer funcionar o ISPRINTER do antigo clipper... pois era assim e nunca tive problemas!
gracias!
aprendi mais uma coisa...JoséQuintas escreveu:hbmk2 -find print
para pesquisar eu usar o F3 do windows e se não achasse usava o próprio F3 do editor de textos NotePad++ em procurar todos os arquivos e pastas (selecionada)... que também aprendi contigo professor!
vou testar agora se funciona o STATUS 128, que é a impressora conectada à lptx mas com cabo desconectado ou ela desligada ou cabo com defeito...
é o que preciso para fazer funcionar o ISPRINTER do antigo clipper... pois era assim e nunca tive problemas!
gracias!
Grato,
MICROVOLUTION - 16 anos Evoluindo Com Você!
Você já leu a Bíblia hoje?
João 3:16 - Porque Deus amou ao mundo de tal maneira que deu seu Único Filho para que todo aquele que nEle crê não pereça mas tenha a Vida Eterna!
MICROVOLUTION - 16 anos Evoluindo Com Você!
Você já leu a Bíblia hoje?
João 3:16 - Porque Deus amou ao mundo de tal maneira que deu seu Único Filho para que todo aquele que nEle crê não pereça mas tenha a Vida Eterna!
-
microvolution
- Usuário Nível 5

- Mensagens: 1231
- Registrado em: 02 Set 2011 22:17
- Contato:
PRINTREADY,PRINTSEND,... Testar Impressora On/Off Line
olha... testei aqui no windwos 10 64 bits... o o retorno é <1... isso significa que o resultado é falso... não tenho nenhuma impressora lptx instalada fisicamente...
então, será que NÃO EXISTE nenhuma LIB ou comandos/funções mesmo em C, ou C++ que verifica no hardware se a impressora está ligada ou não?
que coisa não?
Eis aqui imagens do esquema elétrico da porta paralela... há uns 15 anos atrás, tentava fazer algo que fosse acionado por esta tecnologia: Eu que não entendo nada, mas nada mesmo... tô desde ontem pesquisando nessa m**** de internet... e o único lugar que tem alguma coisa é no nosso fórum...
será que ninguém sabe que resolva? deve existir um código em C++ pra gente colocar no tal de #pragma e fazer essa verificação, pois, nenhuma função do harbour aceita
alguma ideia?
Gente numa época tão avançada como esta agora, e o clipper que é ou era considerado tão atrasado... arcaico, mas, o isprinter() funcionava corretamente..."tava cá com meus butões pensando..."
então, será que NÃO EXISTE nenhuma LIB ou comandos/funções mesmo em C, ou C++ que verifica no hardware se a impressora está ligada ou não?
que coisa não?
Eis aqui imagens do esquema elétrico da porta paralela... há uns 15 anos atrás, tentava fazer algo que fosse acionado por esta tecnologia: Eu que não entendo nada, mas nada mesmo... tô desde ontem pesquisando nessa m**** de internet... e o único lugar que tem alguma coisa é no nosso fórum...
será que ninguém sabe que resolva? deve existir um código em C++ pra gente colocar no tal de #pragma e fazer essa verificação, pois, nenhuma função do harbour aceita
que a gente deixa acontecer o erro TERM/2014 e trate ele...a não ser...
alguma ideia?
Grato,
MICROVOLUTION - 16 anos Evoluindo Com Você!
Você já leu a Bíblia hoje?
João 3:16 - Porque Deus amou ao mundo de tal maneira que deu seu Único Filho para que todo aquele que nEle crê não pereça mas tenha a Vida Eterna!
MICROVOLUTION - 16 anos Evoluindo Com Você!
Você já leu a Bíblia hoje?
João 3:16 - Porque Deus amou ao mundo de tal maneira que deu seu Único Filho para que todo aquele que nEle crê não pereça mas tenha a Vida Eterna!
-
microvolution
- Usuário Nível 5

- Mensagens: 1231
- Registrado em: 02 Set 2011 22:17
- Contato:
PRINTREADY,PRINTSEND,... Testar Impressora On/Off Line
então, como disse, há muitos anos atrás testei (deve ter uns 15 anos ou mais) acender led pela porta paralela e etc...
Então, achei aqui nas minhas "mechelânças" o seguinte código fonte em puro C++:
Imagino que esse código acima deva estar entre as chamadas abaixo para ser reconhecido pelo harbour:
Bom, e, agora, como chamar essa classe TPort ?
vlw!
Então, achei aqui nas minhas "mechelânças" o seguinte código fonte em puro C++:
Código: Selecionar todos
class TPorta
{
private:
public:
void Envia(short int iEndPorta,unsigned char iByte);
unsigned char Recebe(short int iEndPorta);
};
// -----------------------------------------------------------------
// Envia um byte para a Porta Paralela
void TPorta::Envia(short int iEndPorta,unsigned char iByte)
{
_DX = iEndPorta;
_AL = iByte;
__emit__ (0xEE);//Instrução da CPU
}
// -----------------------------------------------------------------
// Recebe um byte pela Porta Paralela
unsigned char TPorta::Recebe(short int iEndPorta)
{
_DX = iEndPorta;
__emit__ (0xEC);//Instrução da CPU
return(_AL);//Retorna um byte
}Código: Selecionar todos
#pragma BEGINDUMP
#pragma ENDDUMPvlw!
Grato,
MICROVOLUTION - 16 anos Evoluindo Com Você!
Você já leu a Bíblia hoje?
João 3:16 - Porque Deus amou ao mundo de tal maneira que deu seu Único Filho para que todo aquele que nEle crê não pereça mas tenha a Vida Eterna!
MICROVOLUTION - 16 anos Evoluindo Com Você!
Você já leu a Bíblia hoje?
João 3:16 - Porque Deus amou ao mundo de tal maneira que deu seu Único Filho para que todo aquele que nEle crê não pereça mas tenha a Vida Eterna!
-
microvolution
- Usuário Nível 5

- Mensagens: 1231
- Registrado em: 02 Set 2011 22:17
- Contato:
PRINTREADY,PRINTSEND,... Testar Impressora On/Off Line
boa noite!
estou acompanhando este tópico e o Viktor Szakats respondeu nele, parece ser uma solução para o problema de TESTAR IMPRESSORA ON/OFF LINE (lx 300 & cia ltda rsrs)...
Mas, meu tradutor não traduz corretamente, mas, ele fala a resposta a respeito de seu link: https://github.com/harbour/core/blob/ma ... /isprint.c
Neste link oficial dele, no final do código tem:
Mas, infelizmente isso pra mim é grego...
Alguém sabe decifrar e dizer se é a solução que todos procuramos?
estou acompanhando este tópico
Código: Selecionar todos
https://groups.google.com/forum/#!topic/harbour-users/uphW9lXb17oMas, meu tradutor não traduz corretamente, mas, ele fala a resposta a respeito de seu link: https://github.com/harbour/core/blob/ma ... /isprint.c
Neste link oficial dele, no final do código tem:
Código: Selecionar todos
HB_FUNC( HB_ISPRINTER )
{
hb_retl( hb_printerIsReady( hb_parc( 1 ) ) );
}
HB_FUNC( ISPRINTER )
{
hb_retl( hb_printerIsReady( NULL ) );
}Alguém sabe decifrar e dizer se é a solução que todos procuramos?
Grato,
MICROVOLUTION - 16 anos Evoluindo Com Você!
Você já leu a Bíblia hoje?
João 3:16 - Porque Deus amou ao mundo de tal maneira que deu seu Único Filho para que todo aquele que nEle crê não pereça mas tenha a Vida Eterna!
MICROVOLUTION - 16 anos Evoluindo Com Você!
Você já leu a Bíblia hoje?
João 3:16 - Porque Deus amou ao mundo de tal maneira que deu seu Único Filho para que todo aquele que nEle crê não pereça mas tenha a Vida Eterna!
- rochinha
- Administrador

- Mensagens: 4664
- Registrado em: 18 Ago 2003 20:43
- Localização: São Paulo - Brasil
- Contato:
PRINTREADY,PRINTSEND,... Testar Impressora On/Off Line
Amiguinhos,
microvolution
Teste assim:
microvolution
Teste assim:
Código: Selecionar todos
Function main()
? IsPrint( "NomeDaSuaImpressora" )
return .t.
#pragma begindump
/*
* IsPrinter() function
*
* Copyright 1999-2007 Viktor Szakats (vszakats.net/harbour)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this software; see the file COPYING.txt. If not, write to
* the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
* Boston, MA 02111-1307 USA (or visit the web site https://www.gnu.org/).
*
* As a special exception, the Harbour Project gives permission for
* additional uses of the text contained in its release of Harbour.
*
* The exception is that, if you link the Harbour libraries with other
* files to produce an executable, this does not by itself cause the
* resulting executable to be covered by the GNU General Public License.
* Your use of that executable is in no way restricted on account of
* linking the Harbour library code into it.
*
* This exception does not however invalidate any other reasons why
* the executable file might be covered by the GNU General Public License.
*
* This exception applies only to the code released by the Harbour
* Project under the name Harbour. If you copy code from other
* Harbour Project or Free Software Foundation releases into a copy of
* Harbour, as the General Public License permits, the exception does
* not apply to the code that you add in this way. To avoid misleading
* anyone as to the status of such modified files, you must delete
* this exception notice from them.
*
* If you write modifications of your own for Harbour, it is your choice
* whether to permit this exception to apply to your modifications.
* If you do not wish that, delete this exception notice.
*
*/
#include "hbapi.h"
#include "hbapifs.h"
#if defined( HB_OS_DOS )
# include <dos.h>
#endif
HB_BOOL hb_printerIsReady( const char * pszPrinterName )
{
HB_BOOL bIsPrinter;
#if defined( HB_OS_DOS )
/* NOTE: MS-DOS specific solution, using BIOS interrupt */
{
int iPort;
if( pszPrinterName == NULL )
pszPrinterName = "LPT1";
if( hb_strnicmp( pszPrinterName, "PRN", 3 ) == 0 )
{
union REGS regs;
regs.h.ah = 2;
regs.HB_XREGS.dx = 0; /* LPT1 */
HB_DOS_INT86( 0x17, ®s, ®s );
bIsPrinter = ( regs.h.ah == 0x90 );
}
else if( strlen( pszPrinterName ) >= 4 &&
hb_strnicmp( pszPrinterName, "LPT", 3 ) == 0 &&
( iPort = atoi( pszPrinterName + 3 ) ) > 0 )
{
union REGS regs;
regs.h.ah = 2;
regs.HB_XREGS.dx = iPort - 1;
HB_DOS_INT86( 0x17, ®s, ®s );
bIsPrinter = ( regs.h.ah == 0x90 );
}
else
bIsPrinter = HB_FALSE;
}
#else
/* NOTE: Platform independent method, at least it will compile and run
on any platform, but the result may not be the expected one,
since Unix/Linux doesn't support LPT/COM by nature, other OSs
may not reflect the actual physical presence of the printer when
trying to open it, since we are talking to the spooler.
[vszakats] */
{
PHB_FILE pFile;
if( pszPrinterName == NULL )
#if defined( HB_OS_UNIX )
pszPrinterName = "/dev/lp0";
#else
pszPrinterName = "LPT1";
#endif
pFile = hb_fileExtOpen( pszPrinterName, NULL,
FO_WRITE | FO_SHARED | FO_PRIVATE, NULL, NULL );
bIsPrinter = ( pFile != NULL );
if( bIsPrinter )
hb_fileClose( pFile );
}
#endif
return bIsPrinter;
}
HB_FUNC( HB_ISPRINTER )
{
hb_retl( hb_printerIsReady( hb_parc( 1 ) ) );
}
HB_FUNC( ISPRINTER )
{
hb_retl( hb_printerIsReady( NULL ) );
}
#pragma enddump
OPS! LINK QUEBRADO? Veja ESTE TOPICO antes e caso não encontre ENVIE seu email com link do tópico para [url=mailto://fivolution@hotmail.com]fivolution@hotmail.com[/url]. Agradecido.
@braços : ? )
A justiça divina tarda mas não falha, enquanto que a justiça dos homens falha porque tarda.
@braços : ? )
A justiça divina tarda mas não falha, enquanto que a justiça dos homens falha porque tarda.
-
microvolution
- Usuário Nível 5

- Mensagens: 1231
- Registrado em: 02 Set 2011 22:17
- Contato:
PRINTREADY,PRINTSEND,... Testar Impressora On/Off Line
infelizmente professor Rochinha o resultado é o que eu já esperava: .t.rochinha escreveu:002 ? IsPrint( "NomeDaSuaImpressora" )
Se a impressora estiver ligada = .t.
Se a impressora estiver DESLIGADA também = .t.
É um falso positivo... "trazudindo"... não serve pra nada essa função do "harbour"...
Grato,
MICROVOLUTION - 16 anos Evoluindo Com Você!
Você já leu a Bíblia hoje?
João 3:16 - Porque Deus amou ao mundo de tal maneira que deu seu Único Filho para que todo aquele que nEle crê não pereça mas tenha a Vida Eterna!
MICROVOLUTION - 16 anos Evoluindo Com Você!
Você já leu a Bíblia hoje?
João 3:16 - Porque Deus amou ao mundo de tal maneira que deu seu Único Filho para que todo aquele que nEle crê não pereça mas tenha a Vida Eterna!
PRINTREADY,PRINTSEND,... Testar Impressora On/Off Line
Prezados,
Tem uma atualização do harbour 3.4 fork sobre Isprint
O comentário do Viktor está no fonte isprint.c
Tem uma atualização do harbour 3.4 fork sobre Isprint
O comentário do Viktor está no fonte isprint.c
►Harbour 3.x | Minigui xx-x | HwGui◄
Pense nas possibilidades abstraia as dificuldades.
Não corrigir nossas falhas é o mesmo que cometer novos erros.
A imaginação é mais importante que o conhecimento. (Albert Einstein)
Pense nas possibilidades abstraia as dificuldades.
Não corrigir nossas falhas é o mesmo que cometer novos erros.
A imaginação é mais importante que o conhecimento. (Albert Einstein)
PRINTREADY,PRINTSEND,... Testar Impressora On/Off Line
de Paula, tente hb_IsPinter("LPT1")
►Harbour 3.x | Minigui xx-x | HwGui◄
Pense nas possibilidades abstraia as dificuldades.
Não corrigir nossas falhas é o mesmo que cometer novos erros.
A imaginação é mais importante que o conhecimento. (Albert Einstein)
Pense nas possibilidades abstraia as dificuldades.
Não corrigir nossas falhas é o mesmo que cometer novos erros.
A imaginação é mais importante que o conhecimento. (Albert Einstein)
