kapiaba Posted August 1, 2017 Report Share Posted August 1, 2017 Pense em um cara dificil é o Silvio Falconi. http://forums.fivetechsupport.com/viewtopic.php?f=3&t=34399 Abs Quote Link to comment Share on other sites More sharing options...
oribeiro Posted March 8, 2018 Report Share Posted March 8, 2018 Pessoal, Peguei esse exemplo no fórum do fivewin, compilei com o hbzebra.lib do xHarbour 1.2.3, mas não está gerando o CódigoQR, vocês sabem onde está o erro? * CodeQR.prg * 08/03/2018 * Programa para gerar código QR #include "fivewin.ch" /* CODEBAR.CH #include "hbzebra.ch" #define CODEBAR_EAN13 1 #define CODEBAR_EAN8 2 #define CODEBAR_UPCA 3 #define CODEBAR_UPCE 4 #define CODEBAR_ITF 5 #define CODEBAR_MSI 6 #define CODEBAR_CODABAR 7 #define CODEBAR_CODE11 8 #define CODEBAR_CODE39 9 #define CODEBAR_CODE93 10 #define CODEBAR_CODE128 11 #define CODEBAR_PDF417 12 #define CODEBAR_DATAMATRIX 13 #define CODEBAR_TYPE 1 #define CODEBAR_BLOCK 2 #define CODEBAR_QRCODE 14 #define DEFAULT_CODEBAR CODEBAR_PDF417 */ Function TesteCodeQR() Local oCode Local oPrn oCode:=TCodeBars():New( 500, 500 ) oCode:nHeightCode = 3 // altura -> 7.23 PAGINA CHEIA oCode:nWidthCode = 3 // Largura -> 7.23 PAGINA CHEIA oCode:SetType( 14 ) // CODEBAR_QRCODE oCode:SetCode( "35141146377222003730599000004630001158179941|20141105134922|10.00|61694805808|m+4o8FY1lig1zcy6VU3t7INVwE6kiA/ykLXKDFZfb9gu0g4wl3Fk2HYaRhSt8G+yk9mP/R65m3R7V2IO8CxnmO1oVtlamB6UKA+UZZqDNEqtYlhQzLySNzMG0thaNMZsq5RxmQ3eQLPw8LLez3MqWvUveFXNSSq6AGEX2+KOdavteo3K2L06SQoVIjwkmcgRzqhfHP3y8t2wfr1nw/WAnaCF9ZY/K4dTykk3hsXcan/MKCTBlcSOhNgSh3sdsQHpl2w2tmbLBsYBLFkuvKlwzHarNJQ1RfRznGdojHglQH1KVtbAUXKke54pdRt3JL7nJlR+Lbmtd2tjcT2vRyTepw==" ) // Texto para gerar o QRCode oCode:SetFlags( 0 ) // Não sei o que é oCode:Build() // Cria o código * PRINT oPrn NAME "Imprimir QrCode" PREVIEW PAGE *Drawbitmap( oPrn, oCode:hCodeBar, 100, 100) *oPrn:SayImage( 100, 100, oCode:hCodeBar, 300, 300 ) *oPrn:SayBitmap( 100, 100, oCode:hCodeBar, 300, 300 ) //Drawbitmap( oPrn:hDCOut, oCode:hCodeBar, 200, 400) Drawbitmap( oPrn:hDCOut, oCode:hCodeBar, 200, 400) //oPrn:Say( 500, 100, "This is a test" ) ENDPAGE ENDPRINT * // oCode:End() // Encerra TCodeBar() Return nil //--------------------------------------// CLASS TCodeBars DATA aTypes HIDDEN DATA cCode DATA nFlags DATA hCodeBar DATA hData DATA nType, nWidth, nHeight, nWidthCode, nHeightCode METHOD New() METHOD End() INLINE DeleteObject( ::hCodeBar ), If( ::hData != NIL, hb_zebra_destroy( ::hData ), ) METHOD DefError( nError ) METHOD SetCode( cCode ) METHOD SetFlags( nFlags ) METHOD SetType( cnType ) METHOD Reset() INLINE ::End() METHOD Build() METHOD Rebuild() INLINE ::Reset(), ::Build() ENDCLASS //--------------------------------------// METHOD New( nWidth, nHeight, nWidthCode, nHeightCode, cnType, cCode, nFlags ) CLASS TCodeBars DEFAULT nWidth := 200,; nHeight := 100,; nWidthCode := 1,; nHeightCode := 3 ::aTypes = { { "EAN13" , {| | hb_zebra_create_ean13( ::cCode, ::nFlags ) } },; { "EAN8" , {| | hb_zebra_create_ean8( ::cCode, ::nFlags ) } },; { "UPCA" , {| | hb_zebra_create_upca( ::cCode, ::nFlags ) } },; { "UPCE" , {| | hb_zebra_create_upce( ::cCode, ::nFlags ) } },; { "ITF" , {| | hb_zebra_create_itf( ::cCode, ::nFlags ) } },; { "MSI" , {| | hb_zebra_create_msi( ::cCode, ::nFlags ) } },; { "CODABAR" , {| | hb_zebra_create_codabar( ::cCode, ::nFlags ) } },; { "CODE11" , {| | hb_zebra_create_code11( ::cCode, ::nFlags ) } },; { "CODE39" , {| | hb_zebra_create_code39( ::cCode, ::nFlags ) } },; { "CODE93" , {| | hb_zebra_create_code93( ::cCode, ::nFlags ) } },; { "CODE128" , {| | hb_zebra_create_code128( ::cCode, ::nFlags ) } },; { "PDF417" , {| | NIL /*hb_zebra_create_pdf417( ::cCode, ::nFlags ) */} },; { "DATAMATRIX" , {| | hb_zebra_create_datamatrix( ::cCode, ::nFlags ) } },; { "QRCODE" , {| | hb_zebra_create_qrcode( ::cCode, ::nFlags ) } } } ::nWidth = nWidth ::nHeight = nHeight ::nWidthCode = nWidthCode ::nHeightCode = nHeightCode ::SetType( cnType ) ::SetCode( cCode ) ::SetFlags( nFlags ) return Self //--------------------------------------// METHOD Build() CLASS TCodeBars local hBmpOld local hDCDesk := GetDC( GetDesktopWindow() ) local hDCMem := CreateCompatibleDC( hDCDesk ) local hBrush := CreateSolidBrush( 0 ) local hBack := CreateSolidBrush( CLR_WHITE ) ::hCodeBar = CreateCompatibleBitMap( hDCDesk, ::nWidth, ::nHeight ) hBmpOld = SelectObject( hDCMem, ::hCodeBar ) ::hData := Eval( ::aTypes[ ::nType ][ 2 ] ) // [ CODEBAR_BLOCK ] ::DefError() FillRect( hDCMem, { 0, 0, ::nHeight, ::nWidth }, hBack ) hb_zebra_draw( ::hData, {| x, y, w, h | FillRect( hDCMem, { y, x, y + h, x + w }, hBrush ) }, 0, 0, ::nWidthCode, ::nHeightCode ) //DrawText( hDCMem, ::cCode, { ::nHeight - 15, 0, ::nHeight, ::nWidth }, 1 ) SelectObject( hDCMem, hBmpOld ) ReleaseDC( GetDesktopWindow(), hDCDesk ) DeleteDC( hDCMem ) DeleteObject( hBrush ) DeleteObject( hBack ) return NIL //--------------------------------------// METHOD SetCode( cCode ) CLASS TCodeBars if ! Empty( cCode ) if ValType( cCode ) != "C" cCode = cValToChar( cCode ) endif ::cCode = cCode endif return NIL //--------------------------------------// METHOD SetFlags( nFlags ) CLASS TCodeBars ::nFlags = nFlags return NIL //--------------------------------------// METHOD SetType( cnType ) class TCodeBars local cType if ( ( cType := ValType( cnType ) )$"CN" ) if cType == "N" if cnType > 0 .and. cnType < 15 ::nType = cnType endif else ::nType = AScan( ::aTypes, {| a | a[ CODEBAR_TYPE ] == Upper( cnType ) } ) endif else ::nType = 12 // DEFAULT_CODEBAR endif return NIL //--------------------------------------// METHOD DefError( ) CLASS TCodeBars local oError local nError := 0 if ::hData != NIL nError = hb_zebra_geterror( ::hData ) endif if nError != 0 hb_zebra_destroy( ::hData ) oError := ErrorNew() oError:SubSystem = "TCODEBARS" oError:SubCode = nError oError:Severity = 2 Eval( ErrorBlock(), oError ) endif RETURN nil //--------------------------------------// #pragma BEGINDUMP #include <hbapi.h> #include <windows.h> HB_FUNC( CREATECOMPATIBLEBITMAP ) // hDC, nWidth, nHeight { hb_retnl( ( LONG ) CreateCompatibleBitmap( ( HDC ) hb_parnl( 1 ), hb_parnl( 2 ), hb_parnl( 3 ) ) ); } #pragma ENDDUMP *Eof( CodeQR.Prg ) Quote Link to comment Share on other sites More sharing options...
kapiaba Posted March 8, 2018 Author Report Share Posted March 8, 2018 Não lembro se é o mesmo, então, veja com este se vai: https://www.4shared.com/zip/TEF-cB4eba/QRCODE.html Abs Quote Link to comment Share on other sites More sharing options...
oribeiro Posted March 8, 2018 Report Share Posted March 8, 2018 Eu consegui gerar o QRCODE em BitMap no disco com a instrução: hDib := DibFromBitmap( oCode:hCodeBar ) DibWrite( "QRCODE.BMP" , hDib ) // Grava arquivo BMP no disco É possível imprimir o código QRCODE sem a necessidade de gerar o arquivo BMP no disco? kapiaba 1 Quote Link to comment Share on other sites More sharing options...
kapiaba Posted March 8, 2018 Author Report Share Posted March 8, 2018 Eu acho que sim. Veja os exeplos no forum inter, direto pela printer.prg. sua versão 18.01 deve estar bem melhorada em relação a QrCode e Código de Barras em geral. Questão de pesquisar no forum inter. abs. Quote Link to comment Share on other sites More sharing options...
cnavarro Posted March 8, 2018 Report Share Posted March 8, 2018 Utiliza la misma function que usas para imprimir en pantalla local nX := 180 local nY := 180 local cCode := "20219719443 | 01 | F001 | 00045256 | 25/01/2018 | 18.00 | 118.00 | 6 | 10087302682 |" local oPrn PRINT oPrn NAME "Imprimir QrCode" PREVIEW PAGE hb_zebra_draw( hZebra, { | x, y, w, h | nWidth := x + w, nHeight := y + h, ; FillRect( oPrn:hDCOut, { y, x, y + h, x + w }, hBrush ) }, nX, nY, 11, 11 ) oFontText:Activate( oPrn:hDCOut ) DrawText( oPrn:hDCOut, cCode, { nHeight + 10 , nX - 4, nHeight + 24, nWidth + 4 }, 0 ) oFontText:DeActivate( oPrn:hDCOut ) ENDPAGE ENDPRINT kapiaba 1 Quote Link to comment Share on other sites More sharing options...
oribeiro Posted March 8, 2018 Report Share Posted March 8, 2018 Funcionou. Muito obrigado. Quote Link to comment Share on other sites More sharing options...
xtsystem Posted May 7, 2018 Report Share Posted May 7, 2018 Ola Ribeiro. E onde esta a função hb_zebra_draw() Quote Link to comment Share on other sites More sharing options...
kapiaba Posted May 7, 2018 Author Report Share Posted May 7, 2018 echo %hdirl%\hbzebra.lib + >> b32.bc 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.