con una clase que encontre en el foro, genero un QR con informaci贸n (que entre mas caracteres tiene es mas grande el QR), el cual lo imprimo en el preview
pero lo simpatico de esto es que genera un archivo BMP y este puede ser puesto en unrecurso "IMAGE" y te puede ayudar a lo que necesitas.
#Include "FiveWin.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_QRCODE 聽 聽 聽 聽 14
#define CODEBAR_TYPE 聽 聽 聽 聽 聽 1
#define CODEBAR_BLOCK 聽 聽 聽 聽 聽2
#define DEFAULT_CODEBAR 聽 聽 聽 聽CODEBAR_PDF417
//--------------------------------------
CREATE 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 ][ 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 = 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
//------------------------------------------------
聽 聽 聽 聽 聽 聽cCodeBar 聽:= "entre mas letras o caracteres tenga es mas grande"
聽 聽 聽 聽 聽 聽oQRCode:= TCodeBars():New( 421, 421, 10, 10, CODEBAR_QRCODE, cCodeBar )
聽 聽 聽 聽 聽 聽oQRCode:Build()
聽 聽 聽 聽 聽 聽GeneraCodigo_QR( oQRCode )
PRINTER oPrn NAME "Tarja Pallet" PREVIEW 聽
PAGE
...
...
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽oPrn:SayImage(4800, 3500 , "..\QrCode.bmp",1200,1200 )
...
...
ENDPAGE
ENDPRINT
//----------------------------------------------------------------------
Function GeneraCodigo_QR( oCode )
聽 聽Local hDib
聽 聽If ( File( ..\QrCode.bmp" ), Ferase( ..\QrCode.bmp" ), )
聽 聽hDib := DibFromBitmap( oCode:hCodeBar )
聽 聽DibWrite( "..\QrCode.bmp", hDib )
聽 聽GloBalFree( hDib )
聽Return nil
//----------------------------------------------------------------------
1.