Código: Selecionar todos
IsPrint( "LPT1" )
...
IsPrint( "LPT2" )
...
IsPrint( "COM1" )
...
Moderador: Moderadores

Código: Selecionar todos
IsPrint( "LPT1" )
...
IsPrint( "LPT2" )
...
IsPrint( "COM1" )
...
Código: Selecionar todos
DEFAULT QuePrinter := "LPT1:"
Código: Selecionar todos
2007-10-16 09:29 UTC+0100 Viktor Szakats (vszakats.net/harbour)
* include/hbextern.ch
* source/rtl/gete.c
+ Added HB_GETENV(). There you have a 2nd parameter
which will be returned in case the requested
envvar doesn't exist. This extensions is still present
in GETE[NV](), but we'd better remove it.
* include/hbextern.ch
* source/rtl/isprint.c
+ Added HB_ISPRINTER() with support for extra parameter
printer port name. This parameter also currently has
support for Win32 printers. Win32 printer name support
was removed from ISPRINTER() to keep compatibility.
ISPRINTER() extra parameter is enabled with HB_COMPAT_XPP
(which is the default).
2010-06-03 09:47 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/contrib/hbnf/ftisprn.c
! fixed HB_ISPRINT() -> HB_ISPRINTER()
2010-02-20 04:48 UTC+0100 Viktor Szakats (vszakats.net/harbour)
* src/rtl/isprint.c
- Deleted dirty Xbase++ extension of ISPRINTER(). Now it's
purely Clipper compatible in default build.
INCOMPATIBLE. For Xbase++ version, use XPP_ISPRINTER()
(or HB_ISPRINTER() which is the exact same).
2009-11-24 10:57 UTC+0100 Viktor Szakats (vszakats.net/harbour)
* contrib/hbwin/Makefile
* contrib/hbwin/win_prn2.c
* contrib/hbwin/win_prn3.c
+ contrib/hbwin/legacycp.c
+ Added new names for Windows printer support functions:
WIN_PRINTEREXISTS() (old name: PRINTEREXISTS())
WIN_PRINTERSTATUS() (old name: XISPRINTER())
WIN_PRINTERPORTTONAME() (old name: PRINTERPORTTONAME())
WIN_PRINTERLIST() (old name: GETPRINTERS())
WIN_PRINTERGETDEFAULT() (old name: GETDEFAULTPRINTER())
WIN_PRINTERSETDEFAULT() (old name: SETDEFAULTPRINTER())
WIN_PRINTFILERAW() (old name: PRINTFILERAW())
; Old names still work, and they are guarded with HB_WIN_LEGACY_LEVEL_OFF
macro, in case someone would like to disable them.
; Please use new names, old ones will be deleted enventually.
Código: Selecionar todos
C:\>hbmk2 -find isprinter
N├║cleo Harbour (instalado):
IsPrinter()
hb_IsPrinter()
xhb.hbc (instalado):
XIsPrinter()
Exemplo para saber o status da impressora e se ela existe.WIN_PRINTEREXISTS() (old name: PRINTEREXISTS())
WIN_PRINTERSTATUS() (old name: XISPRINTER())
WIN_PRINTERPORTTONAME() (old name: PRINTERPORTTONAME())
WIN_PRINTERLIST() (old name: GETPRINTERS())
WIN_PRINTERGETDEFAULT() (old name: GETDEFAULTPRINTER())
WIN_PRINTERSETDEFAULT() (old name: SETDEFAULTPRINTER())
WIN_PRINTFILERAW() (old name: PRINTFILERAW())
Código: Selecionar todos
/* Copyright 2009 Viktor Szakats (vszakats.net/harbour) */
#require "hbwin"
#include "simpleio.ch"
PROCEDURE Main()
Dump( win_printerList( .F., .F. ) )
Dump( win_printerList( .F., .T. ) )
Dump( win_printerList( .T., .F. ) )
Dump( win_printerList( .T., .T. ) )
? "win_printerGetDefault():", ">" + win_printerGetDefault() + "<"
? "win_printerStatus():", hb_ntos( win_printerStatus() )
RETURN
STATIC PROCEDURE Dump( a )
LOCAL b, c
? "==="
FOR EACH b IN a
?
IF HB_ISARRAY( b )
FOR EACH c IN b
?? c:__enumIndex(), c
IF c:__enumIndex() == 2
?? "", ;
">>" + win_printerPortToName( c ) + "<<", ;
"|>>" + win_printerPortToName( c, .T. ) + "<<|"
ENDIF
?
NEXT
? "---"
ELSE
? b, win_printerExists( b ), win_printerStatus( b )
ENDIF
NEXT
RETURN

Tira a linha, desabilita.erro de compilação nessa linha:
syntax error at "QUEPRINTER"Código: Selecionar todos
DEFAULT QuePrinter := "LPT1:"
xHarbour
Olhe atentamente a mensagem do Itamar M. Lins Jr.Mas eu estou compilando no xHarbour
Código: Selecionar todos
nStatus := PrnStatus( QuePrinter )






Não pode. Só usando a classe win_prn().posso usar o startdoc() e o enddoc() so pra acionar a guilhotina ??
Código: Selecionar todos
**********************************
Function PrintCozinha(cArq,cPrint)
**********************************
*
*
Local oPrn, aPrn:=WIN_PRINTERLIST(), n := 0
hb_default(@cPrint,win_PrinterGetDefault())
if empty(aPrn)
hwg_Msginfo('Não há impressoras instaladas')
return .f.
endif
If cPrint == Nil
cPrint := win_PrinterGetDefault()
EndIf
cText := memoread(cArq)
nLinh := mlcount(cText)
nTL := (nLinh/5)
oPrn := win_prn():New(cPrint)
oPrn :LandScape := .F.
oPrn :FormType := WIN_DMPAPER_USER
oPrn :PaperLength := 8.5*25.4*nTL
oPrn :PaperWidth := 3*25.4*10
oPrn :Copies := 1
if !oPrn:Create()
hwg_Msginfo("Não foi criado documento.")
Return nil
EndIf
if !oPrn:StartDoc("Cozinha: "+cArq)
hwg_Msginfo("Erro na Impressora.")
Return nil
EndIf
oPrn:SetColor( HB_WIN_RGB_BLACK )
oPrn:SetFont( "Lucida Console", 15, { 4, -70 } ) //escolha uma fonte!! pode mudar esse exemplo e diagramar o texto todo.
For n := 1 to nLinh
oPrn:Textout(memoline(cText,,n),.t.)
Next
oPrn:NewLine() //isso aqui não tem efeito :-( porque o tamanho do papel(comprimento) já foi setado antes lá em cima !!!
oPrn:EndDoc()
Return .T.
Código: Selecionar todos
ASSOCIACAO XYZ
Garçon.: MICK
Mesa...: 002
Setor..: 02 Comanda: 000014679
Fone...: (99) 9999-9999
27 de Setembro de 2015 12:14:19 am
================================================
Descrição-------------------Qtd---Unit-----Total
================================================
FRANGO PARMEGIANA "RF 1 42,00 42,00
Sub Total.....................: 42,00
0,00
Forma Pgto: DINHEIRO 42,00
_____________
Total.........................: 42,00
Obrigado! Volte Sempre!