dorneles Posted August 15, 2023 Report Share Posted August 15, 2023 no windows 11, quando manda imprimir na matricial, nao imprime, esta gerando um arquivo com o nome da porta LTP3.PRN, alguma dica? Quote Link to comment Share on other sites More sharing options...
kapiaba Posted August 15, 2023 Report Share Posted August 15, 2023 Use: PrintFileRaw() // ---------------------------------------------------------------------------- //----- Definicao de comando SAY para TdosPrn --------------------------------- // #xcommand @ <nRow>, <nCol> SAY <cText> OF <oPrinter> => <oPrinter>:Say(<nRow>, <nCol>, <cText> ) //-------------------------------------------------------------------------// // Imprime os Cupons Nao Fiscal da Pizzaria/Restaurante //-------------------------------------------------------------------------// STATIC FUNCTION IMPRIMIR_CUPOM( nKey, aGetVenda, oLbx, oDlgVendas, DbClientes,; DbEstoque, DbPedidos ) FIELD QTD_VENDEU, DESCRICAO, VLUNITARIO, TOTITEM, TOTPEDIDO FIELD MENSAG1, MENSAG2, MENSAG3, MENSAG4, MENSAG5 LOCAL nLinha, nPag, oPrn, Conta, Pula, DbMensag MEMVAR XNUMPEDIDO, nNumeroTel, cCodClien, cNomeClien, cEndClien, ; cNomeProduto, nQuantidade, nValorProd, nValorCompra, oSayCxLivre,; XCGCCLI, nQtdeEstoque, nCodigoProd MEMVAR nDinheiro, nCheque, nChequePre, nTickets, nCartaoCred,; nCartaoDebi, nContraVale, nTaxaEntreg, nValorTroco, nSomaSubTot,; XTROCOCLI, Valor_Pago, nValor_Pago, oSayEmpresa //-> Nome Fantasia da Empresa - Est em EMPRESA.DBF PUBLIC XDA, XCAIXA, XCODVEND, XNOMEEMP, XFANTASIA, XIMPQTDECOP, ; XPULARLINHA nLinha := 0 nPag := 1 //-> Mensagens do Rodape IF NETUSE( "MENSAGEM", .T. ) DATABASE DbMensag DbMensag:Load() //-> Temporario = a FP_PROV.DBF DbMensag:SetBuffer( .T. ) ENDIF SELECT ( DbPedidos:cAlias ) DbPedidos:SetOrder( 1 ) GO TOP // Para Rede de Computadores // oPrn:New("\\seuterminal\suaimpressora\LPT1") oPrn:= TDosPrn():New( "CUPOM.TXT" ) // para ir para um arquivo .txt // oPrn:= TDosPrn():New() // para ir para impressora em definitivo // oPrn := TDosPrn():New("lpt1") // para ir para impressora em definitivo // Este Comando, Liga a Impressora. NÆo Tirar Nunca oPrn:StartPage() // da Start(inicializa) na p gina. oPrn:lZeraBuffer := .T. // Inibe o Pulo da P gina //-> Inicia a Impressao - Cabe‡alho do Cupom //-> Modo Draft @ nLinha, 00 SAY +CHR(18)+CHR(27)+"2"+CHR(27)+"H" OF oPrn @ nLinha, 00 SAY SUBST( XNOMEEMP, 1, 23 ) OF oPrn nLinha := nLinha + 1 @ nLinha, 00 SAY CHR(15)+REPLICATE("-",40) OF oPrn nLinha := nLinha + 1 //-> Modo Condensado @ nLinha, 00 SAY CHR(15)+"HORA: " + TIME() + " - " + ; + DTOC(XDA) OF oPrn nLinha := nLinha + 1 @ nLinha, 00 SAY OemToAnsi("PEDIDO N§: " ) + ; ALLTRIM(STRZERO( XNUMPEDIDO ) ) OF oPrn nLinha := nLinha + 1 @ nLinha, 00 SAY "FONE..: " + nNumeroTel OF oPrn nLinha := nLinha + 1 @ nLinha, 00 SAY SUBSTR( cNomeClien, 1, 40 ) OF oPrn nLinha := nLinha + 1 @ nLinha, 00 SAY SUBSTR( cEndClien, 1, 40 ) OF oPrn nLinha := nLinha + 1 @ nLinha, 00 SAY REPLICATE("-",40) OF oPrn nLinha := nLinha + 1 @ nLinha, 00 SAY "Cod Qtde Descricao Unit Valor" OF oPrn nLinha := nLinha + 1 @ nLinha, 00 SAY REPLICATE("-",40) OF oPrn nLinha := nLinha + 1 //-> Imprime o Pedido WHILE !EOF() SYSREFRESH() IF EOF() EXIT ENDIF @ nLinha, 00 SAY ( DbPedidos:cAlias )->CODIGO OF oPrn nLinha := nLinha + 1 @ nLinha, 00 SAY ( ALLTRIM( STR( QTD_VENDEU ) ) ) +[ - ]+ ; ( SUBSTR( DESCRICAO, 01, 17 ) ) OF oPrn nLinha := nLinha + 1 @ nLinha, 00 SAY ( SUBSTR( DESCRICAO, 18, 35 ) ) + ; TRANSFORM( VLUNITARIO, "@E 99,999.99" ) + ; TRANSFORM( TOTITEM, "@E 999,999.99" ) OF oPrn nLinha := nLinha + 1 DBSKIP() ENDDO //-> Total do Pedido IF EOF() .OR. TOTPEDIDO <= 0 SKIP(-1) ENDIF @ nLinha, 00 SAY CHR(15)+REPLICATE("-",40) OF oPrn nLinha := nLinha + 1 IF nDinheiro > 0 @ nLinha, 00 SAY "EM DINHEIRO: " + ; TRANSFORM( nDinheiro, "@E 999,999.99" ) OF oPrn nLinha := nLinha + 1 ENDIF IF nCheque > 0 @ nLinha, 00 SAY "EM CHEQUE: " + ; TRANSFORM( nCheque, "@E 999,999.99" ) OF oPrn nLinha := nLinha + 1 ENDIF IF nChequePre > 0 @ nLinha, 00 SAY "EM CHEQUE PRE: " + ; TRANSFORM( nChequePre, "@E 999,999.99" ) OF oPrn nLinha := nLinha + 1 ENDIF IF nTickets > 0 @ nLinha, 00 SAY "EM TICKETS: " + ; TRANSFORM( nTickets, "@E 999,999.99" ) OF oPrn nLinha := nLinha + 1 ENDIF IF nCartaoCred > 0 @ nLinha, 00 SAY "EM C. CREDITO: " + ; TRANSFORM( nCartaoCred, "@E 999,999.99" ) OF oPrn nLinha := nLinha + 1 ENDIF IF nCartaoDebi > 0 @ nLinha, 00 SAY "EM C. DEBITO: " + ; TRANSFORM( nCartaoDebi, "@E 999,999.99" ) OF oPrn nLinha := nLinha + 1 ENDIF IF nContraVale > 0 @ nLinha, 00 SAY "EM C. VALE: " + ; TRANSFORM( nContraVale, "@E 999,999.99" ) OF oPrn nLinha := nLinha + 1 ENDIF @ nLinha, 00 SAY CHR(15)+REPLICATE("-",40) OF oPrn nLinha := nLinha + 1 //-> Fechou o Cupom @ nLinha, 00 SAY +CHR(18)+CHR(27)+"2"+CHR(27)+"H" + ; "TOTAL: " + ; TRANSFORM( TOTPEDIDO, "@E 9,999,999.99" ) OF oPrn nLinha := nLinha + 1 @ nLinha, 00 SAY CHR(15)+REPLICATE("-",40) OF oPrn nLinha := nLinha + 1 @ nLinha, 00 SAY CHR(15)+"TROCO: " + ; TRANSFORM( XTROCOCLI, "@E 999,999.99" ) OF oPrn nLinha := nLinha + 1 @ nLinha, 00 SAY "CAIXA: " + STRZERO( XCAIXA, 3 ) + [ - ] + ; "OPERADOR: " + XCODVEND OF oPrn nLinha := nLinha + 1 @ nLinha, 00 SAY CHR(15)+REPLICATE("-",40) OF oPrn nLinha := nLinha + 1 SELECT ( DbMensag:cAlias ) GO TOP WHILE !EOF() SYSREFRESH() IF EOF() EXIT ENDIF IF (MENSAG1 ) != SPACE(40) @ nLinha, 00 SAY MENSAG1 OF oPrn nLinha := nLinha + 1 ENDIF IF (MENSAG2 ) != SPACE(40) @ nLinha, 00 SAY MENSAG2 OF oPrn nLinha := nLinha + 1 ENDIF IF (MENSAG3 ) != SPACE(40) @ nLinha, 00 SAY MENSAG3 OF oPrn nLinha := nLinha + 1 ENDIF IF (MENSAG4 ) != SPACE(40) @ nLinha, 00 SAY MENSAG4 OF oPrn nLinha := nLinha + 1 ENDIF IF (MENSAG5 ) != SPACE(40) @ nLinha, 00 SAY MENSAG5 OF oPrn nLinha := nLinha + 1 ENDIF @ nLinha, 00 SAY CHR(15)+REPLICATE("-",40) OF oPrn nLinha := nLinha + 1 DBSKIP() ENDDO //-> Pulos do Cupom FOR PULA = 1 TO XPULARLINHA @ nLinha, 00 SAY " " OF oPrn nLinha := nLinha + 1 NEXT PULA //-> Modo Draft @ nLinha, 00 SAY +CHR(18)+CHR(27)+"2"+CHR(27)+"H" OF oPrn oPrn:EndPage() oPrn:End() //--- imprime no spool do windows, liberando o micro para trabalhar. ImpSpool( "CUPOM.TXT",, .T. ) //--- opcionamente pode-se apagar o arquivo passando .t. no 3o. parametro. DbMensag:Close() SELECT ( DbPedidos:cAlias ) DbPedidos:SetOrder( 1 ) DbPedidos:Gotop() RETURN NIL // Maravilhoso Ednaldo Cabra Bom!!! //----------------------------------------------------------------------------// // Funcao : ImpSpool( cFileTxt, cPorta, lErase ) // Autor : Ednaldo Rolim (edrol@pop.com.br) // Descricao : Envia um arquivo TXT criado pela TDosPrn para uma // porta de Impressora. //----------------------------------------------------------------------------// FUNCTION ImpSpool( cFileTxt, cPorta, lErase ) LOCAL CPRINTER //para capturar antes da impressão //cPorta := PrnGetPorta() //WinExec( cPorta ) //depois da impressão //WinExex( "Net Use Lpt1: \Delete" ) //Ficou mais facil e simples do que criar as portas na Classe TDosPrn //cPorta := If( cPorta == nil, Alltrim( PrnGetPort() ), cPorta ) ; lErase := If( lErase == nil, .T., lErase ); //cPorta := PrnGetPort() Default cPorta := Alltrim( PrnGetPort() ), lErase:= .t. cPrinter := PrinterPortToName( cPorta ) IF EMPTY( cPrinter ) cPrinter := PrinterPortToName( "USB002" ) IF EMPTY(cPrinter) cPrinter := PrinterPortToName( "USB001" ) ENDIF ENDIF IF .NOT. FILE( cFileTxt ) MsgInfo( OemToAnsi( "NÇO ACHEI O ARQUIVO MODO TEXTO PARA IMPRIMIR NA MATRICIAL" ), ; OemToAnsi( "NÇO ACHEI O ARQUIVO MODO TEXTO PARA IMPRIMIR NA MATRICIAL" ) ) RETURN( .F. ) ENDIF IF .NOT. EMPTY( cPrinter ) // TEM USB PrintFileRaw( cPrinter, TrueName( "CUPOM.TXT" ), "Impressão de Vendas" ) ELSEIF LEN( cPorta ) <= 5 .and. Left( Upper(cPorta), 4 ) = "LPT1" //--- Spool Local - Matricial em LPT1 cPorta:= "PRN" WAITRUN("COMMAND.COM /C COPY /B " + cFileTxt + " " + cPorta, 0 ) ELSE //--- Spool Remoto - Matricial em LPT1 WAITRUN("COMMAND.COM /C COPY /B " + cFileTxt + " " + cPorta, 0 ) ENDIF IF lErase // Vem .T. da tela de vendas FERASE( cFileTxt ) ENDIF RETURN( .T. ) Regards, saludos. Quote Link to comment Share on other sites More sharing options...
dorneles Posted August 15, 2023 Author Report Share Posted August 15, 2023 com o PrintFileRaw(), fica com a impressão grafica, fica estranho Quote Link to comment Share on other sites More sharing options...
kapiaba Posted August 15, 2023 Report Share Posted August 15, 2023 Como assim? Tais usando alguma TDOSPRN.PRG modificada por algum maluco do forum Inter? Regards, saludos. Quote Link to comment Share on other sites More sharing options...
kapiaba Posted August 15, 2023 Report Share Posted August 15, 2023 /* ÚÄ Programa ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ ³ Aplication: Class TDosPrint ³ ³ File: TDOSPRN.PRG ³ ³ Author: Ignacio Ortiz de Z£¤iga Echeverr¡a ³ ³ CIS: Ignacio Ortiz (Ignacio_Ortiz) ³ ³ Internet: http://www.ozs.com ³ ³ Date: 09/13/96 ³ ³ Time: 20:20:07 ³ ³ Copyright: 1997 by Ortiz de Zu¤iga, S.L. ³ ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ NOTES: This peace of software is freeware and is not part of FiveWin. The following code will let you print directly to the printer from inside any Fivewin program, like OLD DOS days. Those users that need DOS printing speed can use this class instead of the TPrinter class. The use of the class is very easy and is very similar to the TPrinter class of Fivewin, but we have not create any command to avoid the use of any static vars. This is a little sample of how to use the new class: LOCAL oPrn oPrn := TDosPrn():New("lpt1") oPrn:StartPage() // optional oPrn:Say(10,20, "This goes in line 10, column 20") oPrn:EndPage() // optional oPrn:End() A little description of all the members of this class: DATA: cPort: Printing port, by default "LPT1" cCompress: String for compressed mode, by default "15" cNormal: String for normal mode, by default "18" cFormFeed: String for EJECT, by default "12" hDC: Printing file Handle (Internal use) nRow: Current printing row nCol: Current pringing column nLeftMargin: Left margin, by default 0 nTopMargin: Top margin, by default 0 METHODS: New(cPort) Constructor, no comment End() Destructor, no comment StartPage() Begining of a page, this method is optional EndPage() End of page, this method is optional if there is only on page, or you try to print in a row that is before the current one, like it did happen with the SAY command Command(c) Let you send any command to the printer without changing the current row and col. The string to pass as a parameter should content the ascii values of the command separated with commas, for example, the command to reset Epson printers should be: "27,69" SetCoors(r,c) Let you change the current row and col is the equivalent of SetPrc() of Ca-Clipper NewLine() Increments the current row Write(cText) Prints the string cText in the current row and column Say(nRow ,; Prints the string cText in nRow, nCol nCol ,; cText ) SayCmp() The same as the method Say but prints in compressed mode and the row is updated accordly. NOTE: At the end of this class is a little function call WorkSheet that will make the job of DOS printing a lot easier. Enjoy it! */ /* // Baixei de www.fivewin.com.br em 01/11/2002 // Modifiquei em 03/11/2002 - karinhannah@bol.com.br By JoÆo. // InclusÆo: Parte Modificada Por Ednaldo Rolim - edrol@pop.com.br // Acrescentada a Parte Modificada Pelo Gilmer: www.fivewin.com.br */ #Include "FiveWin.Ch" #Include "Fileio.Ch" #Translate nTrim(<n>) => AllTrim(Str(<n>,10,0)) #define PF_BUFLEN 2048 //----------------------------------------------------------------------------// CLASS TDosPrn DATA LastError DATA cPort, cCompress, cNormal, cFormFeed, cBuffer DATA hDC, nRow, nCol, nLeftMargin, nTopMargin DATA lAnsiToOem, lCompress DATA lZeraBuffer // By Gilmer www.fivewin.com.br DATA ImpUSB // AS LOGICAL By Diego@sysfar.com.br // Imprimir na USB DATA oWnd, oPagina // Ednaldo DATA nPage AS NUMERIC // Ednaldo //METHOD New(cPort) CONSTRUCTOR METHOD New(cPort, cVerUSB) CONSTRUCTOR // By Diego da Sysfar METHOD End() // Antigo(Old) // METHOD StartPage() VIRTUAL // NÆo Conta as P ginas // METHOD EndPage() // Novo (New) // Conta as P ginas By Ednaldo Rolim METHOD StartPage() INLINE ::ShowProc() // Ednaldo METHOD EndPage() // METHOD Command(xPar1, xPar2, xPar3, xPar4, xPar5) //velho METHOD Command(cStr1, cStr2, cStr3, cStr4, cStr5) // novo METHOD SetCoors(nRow, nCol) METHOD NewLine() INLINE (::cBuffer += CRLF ,; ::nRow++ ,; ::nCol := 0 ) METHOD Write(cText, lAToO) ; INLINE (IIF(lAtoO == NIL, lAtoO := .T.,),; ::cBuffer += iif(lAtoO, AnsitoOem(cText), cText) ,; ::nCol += len(cText) ) METHOD Say(nRow, nCol, cText, lAToO) METHOD SayCmp(nRow, nCol, cText) METHOD CharSay(nRow,nCol,cText) INLINE (IIf(::lCompress,; ::SayCmp(nRow,nCol,cText),; ::Say(nRow,nCol,cText))) METHOD ZeraBuffer() // By. Gilmer METHOD PrintFile(cFile) METHOD ShowProc() // Ednaldo ENDCLASS //----------------------------------------------------------------------------// METHOD New( cPort, lFile, lCompress, cVerUSB ) CLASS TDosPrn DEFAULT cPort := "LPT1", ; cVerUSB := .F., ; lFile := .T. , ; lCompress := .F. cPort := Upper(cPort) /* // Copiei de DOSPRINT.PRG [EPSON] Normal=18 Bold=27,18,27,69 Medium=27,70,27,58 Compress=15 Large=27,69,27,18,27,14 Tiny=27,70,27,83,0,27,49,18,15 NoTiny=27,70,27,84,27,50 FormFeed=12 Length=27,67,0 [OKIDATA] Normal=27,70,27,84,27,50,27,15,18 Bold=27,18,27,69 Medium=27,70,27,58 Compress=27,70,27,84,27,15 Large=27,69,27,18,27,14 Tiny=27,70,27,83,0,27,49,18,15 NoTiny=27,70,27,84,27,50 Image=27,76 Header= Footer= Jump=216 FormFeed=12 Length=27,67,0 */ ::ImpUSB := .F. ::cCompress := "15" ::cNormal := "18" ::cFormFeed := " " // 12 //Pulo de P gina ::cBuffer := "" ::nLeftMargin := 0 ::nTopMargin := 0 ::nRow := 0 ::nCol := 0 ::lAnsiToOem := .T. ::cPort := cPort + iif(!"." $ cPort, ".PRN", "") If cVerUSB .and. upper( PrnGetPort( ) )="USB" //::cPort := DirTempdoWindows()+"\usb.imp" ::cPort := cPort + iif(!"." $ cPort, ".IMP", "") Endif ::hDC := fCreate(::cPort) ::LastError := 0 // By. Gilmer // .F. Pula P gina, .T. NÆo Pula a P gina (Cupom Fiscal) ::lZeraBuffer := .F. IF ::hDC < 0 ::LastError := fError() ENDIF ::nPage := 1 // Ednaldo ::ShowProc() // Ednaldo RETURN Self //----------------------------------------------------------------------------// METHOD End() CLASS TDosPrn IF !empty(::nRow+::nCol) ::EndPage() ENDIF ::LastError := 0 IF !fClose(::hDC) ::LastError := fError() ENDIF CursorArrow() if ::oWnd != Nil // Ednaldo ::oWnd:End() // Ednaldo endif // Ednaldo RETURN NIL //----------------------------------------------------------------------------// METHOD EndPage() CLASS TDosPrn LOCAL nFor, nLen, nSec LOCAL lError If !::lZeraBuffer // By Gilmer ::Command(::cFormFeed) End ::LastError := 0 IF fWrite(::hDC, ::cBuffer) < len(::cBuffer) ::LastError := fError() ENDIF ::cBuffer := "" ::nRow := 0 ::nCol := 0 RETURN NIL //----------------------------------------------------------------------------// //METHOD Command(xPar1, xPar2, xPar3, xPar4, xPar5) CLASS TDosPrn // Velho METHOD Command(cStr1, cStr2, cStr3, cStr4, cStr5) CLASS TDosPrn // Novo LOCAL cCommand, cToken, cString LOCAL nToken //cString := cValToChar(xPar1) // Velho cString := cStr1 // Novo /* // Velho IF xPar2 != NIL cString += ","+cValToChar(xPar2) ENDIF */ IF cStr2 != NIL cString += ","+cStr2 ENDIF /* // Velho IF xPar3 != NIL cString += ","+cValToChar(xPar3) ENDIF */ IF cStr3 != NIL cString += ","+cStr3 ENDIF /* // Velho IF xPar4 != NIL cString += ","+cValToChar(xPar4) ENDIF */ IF cStr4 != NIL cString += ","+cStr4 ENDIF /* // Velho IF xPar5 != NIL cString += ","+cValToChar(xPar5) ENDIF */ IF cStr5 != NIL cString += ","+cStr5 ENDIF cCommand := "" nToken := 1 DO WHILE !Empty(cToken := StrToken(cString, nToken++, ",")) cCommand += Chr(Val(cToken)) ENDDO ::cBuffer += cCommand RETURN NIL //----------------------------------------------------------------------------// METHOD SetCoors(nRow, nCol) CLASS TDosPrn nRow += ::nTopMargin nCol += ::nLeftMargin IF ::nRow > nRow ::EndPage() ::nPage++ // Ednaldo ::StartPage() ENDIF /* // do Site IF ::nRow > nRow ::EndPage() ::StartPage() ENDIF */ // Tava Aqui /* // do Site IF nRow == ::nRow .AND. nCol < ::nCol ::EndPage() ::StartPage() ENDIF */ DO WHILE ::nRow < nRow ::NewLine() ENDDO IF nCol > ::nCol ::Write(Space(nCol-::nCol)) ENDIF // Para Imprimir Primeiro na coluna desejada exemplo 1§ na Coluna 50 // Depois na coluna 05... By NetSpeed Inverte-se a Ordem da Cabe‡a de // ImpressÆo, Come‡ando do Fim Para o Inicio... If nRow == ::nRow .and. nCol < ::nCol ::Write(Chr(13)) // NetSpeed Endif // Aqui Inicia da Coluna 1 em diante, nÆo faz como a anterior. // Ou Seja do Inicio Para o Fim da Cabe‡a de ImpressÆo, o Que ‚ Normal. IF nRow == ::nRow .AND. nCol < ::nCol ::EndPage() ::nPage++ // Ednaldo ::StartPage() ENDIF // By. Gilmer If Len(::cBuffer)>=7928 ::ZeraBuffer() Endif RETURN NIL //----------------------------------------------------------------------------// METHOD Say(nRow, nCol, cText, lAToO) CLASS TDosPrn DEFAULT lAToO := ::lAnsiToOem IF VALTYPE( cText ) = "D" cText := DTOC( cText ) ENDIF IF VALTYPE( cText ) = "N" cText := STR( cText ) ENDIF ::SetCoors(nRow, nCol) ::Write(cText, lAToO) RETURN NIL //----------------------------------------------------------------------------// METHOD SayCmp(nRow, nCol, cText, lAToO) CLASS TDosPrn DEFAULT lAToO := ::lAnsiToOem ::Command(::cCompress) ::SetCoors(nRow, nCol) ::cBuffer += iif(lAToO, AnsitoOem(cText), cText) ::nCol += Int(len(cText)) * by Digao ::nCol += Int(len(cText)/1.7+.5) ::Command(::cNormal) RETURN NIL //----------------------------------------------------------------------------// METHOD ZeraBuffer() CLASS TDosPrn /* // Em Ingles ::LastError := 0 If ::lZeraBuffer IF fWrite(::hDC, ::cBuffer) < len(::cBuffer) ::LastError := fError() ENDIF ::cBuffer := "" Endif */ // Em Clipper Puro Como ‚! Self:LastError := 0 If Self:lZeraBuffer IF fWrite(Self:hDC, Self:cBuffer) < len(Self:cBuffer) Self:LastError := fError() ENDIF Self:cBuffer := "" Endif RETURN NIL //----------------------------------------------------------------------------// FUNCTION WorkSheet(cPort) LOCAL oPrn LOCAL cLine LOCAL nFor cLine := "" FOR nFor := 0 TO 7 cLine += Str(nFor,1)+Replicate(".",9) NEXT cLine := Substr(cLine,3) oPrn := TDosPrn():New(cPort) oPrn:StartPage() //alterei em 29/03/2004, Pois Com o Five 2.4, Pulo de P gina estava errado FOR nFor := 0 TO 56 //65 oPrn:Say(nFor,0,StrZero(nFor,2)+cLine) NEXT oPrn:EndPage() oPrn:End() RETURN NIL //----------------------------------------------------------------------------// METHOD PrintFile(cFile) CLASS TDosPrn LOCAL hFile LOCAL nRead LOCAL cBuffer hFile := FOpen(cFile, FO_READ) IF hFile < 0 RETURN .F. ENDIF cBuffer := Space(PF_BUFLEN) DO nRead := fRead(hFile, @cBuffer, PF_BUFLEN) IF fWrite(::hDC, Left(cBuffer, nRead)) < nRead ::LastError := fError() fClose(hFile) RETURN .F. ENDIF UNTIL nRead == PF_BUFLEN fClose(hFile) RETURN .T. //----------------------------------------------------------------------------// // Visualiza Processo de impressao // Ednaldo //----------------------------------------------------------------------------// METHOD ShowProc() CLASS TDosPrn IF ::oWnd = Nil * DEFINE DIALOG ::oWnd TITLE "Imprimindo ..." ; * FROM 230, 217 TO 360, 575 PIXEL ; * COLORS CLR_BLACK, nRGB(193,205,205) * * @ 10, 08 TO 40, 172 OF ::oWnd PIXEL * * @ 1.4, 2 ICON NAME "PRINT.ICO" OF ::oWnd * * @ 25, 35 SAY "Imprimindo Página :" ; * PIXEL OF ::oWnd SIZE 70, 12 RIGHT * * @ 25, 107 SAY ::oPagina VAR ::nPage ; * PIXEL OF ::oWnd UPDATE SIZE 15, 12 RIGHT * * @ 47, 60 BUTTON "Aguarde..." SIZE 60, 12 ; * PIXEL OF ::oWnd ACTION .t. * * ::oWnd:bPainted := {|| iif(::nPage>0, ::oPagina:Refresh(), )} * * ACTIVATE DIALOG ::oWnd CENTER NOWAIT * * EndDialog() ResAllFree() CursorWait() SysRefresh() ELSE ::oWnd:BeginPaint() ::oWnd:Paint() ::oWnd:EndPaint() ENDIF RETURN NIL // Fim do Programa. Regards, saludos. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.