qrcode

qrcode

Postby Silvio.Falconi » Mon Jul 31, 2017 5:22 pm

How create and print a qrcode on Harbour ?
how print a QrCode in oprn:...
Is it possible to print the QrCode also in a report ?

please a small test sample

thanks
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 7076
Joined: Thu Oct 18, 2012 7:17 pm

Re: qrcode

Postby karinha » Mon Jul 31, 2017 5:28 pm

João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7848
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: qrcode

Postby betoncu » Mon Jul 31, 2017 5:49 pm

Code: Select all  Expand view  RUN
oCode := TCodeBars():New(370,370)
oCode:Reset()
oCode:nHeightCode =  10
oCode:nWidthCode  =  10
oCode:SetType( 14 )   //CODEBAR_QRCODE
oCode:SetCode( "your text will be written here" )
oCode:SetFlags(0)
oCode:Build()

Drawbitmap( oPrn:hDCOut, oCode:hCodeBar, nRow*86, nCol*90)
           
Birol Betoncu
birol.betoncu@gmail.com
Using Harbour, FWH 19.05, BCC7
User avatar
betoncu
 
Posts: 126
Joined: Sat Oct 08, 2005 9:38 pm
Location: Cyprus (North)

Re: qrcode

Postby karinha » Tue Aug 01, 2017 1:46 pm

Code: Select all  Expand view  RUN

/*
Use in c:\xharbour\include:
harupdf.ch
hbzebra.ch
*/


#Include "Fivewin.ch"
#Include "Codebar.ch"

#define PAD_LEFT            0
#define PAD_RIGHT           1
#define PAD_CENTER          2

function Main()

   local oPrn, oFont, oPen
   Local nLinI, nColI, nLinF, nColF, oCode, nRow, nCol

   PRINT oPrn NAME "Print QrCode" PREVIEW

      DEFINE FONT oFont NAME "Arial" SIZE 0, -10 BOLD OF oPrn
      DEFINE PEN oPen WIDTH  2                        OF oPrn
 
      oPrn:SetPage(9)  // A4
      oPrn:SetPortrait() //Vertical
      PAGE

         oCode := TCodeBars():New(370,370)
         oCode:Reset()
         oCode:nHeightCode =  10
         oCode:nWidthCode  =  10
         oCode:SetType( 14 )   //CODEBAR_QRCODE
         oCode:SetCode( "your text will be written here" )
         oCode:SetFlags(0)
         oCode:Build()

         Drawbitmap( oPrn:hDCOut, oCode:hCodeBar, 500, 500)

      ENDPAGE

   ENDPRINT

   oFont:End()
   oPen:End()

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 ][ 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


/*
// 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_QRCODE         14

#define CODEBAR_TYPE           1
#define CODEBAR_BLOCK          2

#define DEFAULT_CODEBAR        CODEBAR_PDF417
*/

 


Regards,
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7848
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: qrcode

Postby Silvio.Falconi » Tue Aug 01, 2017 3:48 pm

ok but I cannot compile on Harbour zebra lib
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 7076
Joined: Thu Oct 18, 2012 7:17 pm

Re: qrcode

Postby Silvio.Falconi » Tue Aug 01, 2017 3:53 pm

Now I compile with harbour zebra sources (codebar.prg and all .c files)
now I 'm compiling your test and I have this error



Code: Select all  Expand view  RUN
Progetto: test, Ambiente: bcc7Harbor:
[1]:Harbour.Exe test.prg  /m /n0 /gc1 /es2 /a /iC:\Work\fwh\include /iC:\work\HARBOUR\Include /jC:\Work\Errori\BARCOD~1\I18n\Main.hil /iinclude;c:\work\fwh\include;C:\work\HARBOUR\include /oObj\test.c
Harbour 3.2.0dev (r1406271520)
Copyright (c) 1999-2014, http://harbour-project.org/
Compiling 'test.prg'...
Lines 5040, Functions/Procedures 8
Generating C source output to 'Obj\test.c'... Done.
[1]:Bcc32.Exe -M -c -DHB_OS_WIN_32 -DHB_FM_STATISTICS_OFF -DHB_NO_DEFAULT_API_MACROS -DHB_NO_DEFAULT_STACK_MACROS -IC:\Work\fwh\include -IC:\work\bcc7\Include\windows\sdk\;C:\work\HARBOUR\Include  -nC:\Work\Errori\BARCOD~1\Obj test.c
Embarcadero C++ 7.00 for Win32 Copyright (c) 1993-2015 Embarcadero Technologies, Inc.
test.c:
[1]:iLink32.Exe -Gn -aa -Tpe -s -v @test.bcl
Turbo Incremental Link 6.70 Copyright (c) 1997-2014 Embarcadero Technologies, Inc.
Error: Unresolved external '_HB_FUN_HB_ZEBRA_CREATE_QRCODE' referenced from C:\WORK\ERRORI\BARCODE_ZEBRA\OBJ\TEST.OBJ
Error: Unable to perform link
 
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 7076
Joined: Thu Oct 18, 2012 7:17 pm

Re: qrcode

Postby Silvio.Falconi » Tue Aug 01, 2017 4:00 pm

ok resolved !!
linked hbzebra.lib
and I check with my smarthphone ( qrcode reader ) ....run ok :D
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 7076
Joined: Thu Oct 18, 2012 7:17 pm

Re: qrcode

Postby karinha » Tue Aug 01, 2017 4:04 pm

Why not?

Silvio:

Code: Select all  Expand view  RUN

@ECHO OFF
CLS
ECHO ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
ECHO ³ FiveWin for Harbour 17.01 - Jan.  2017          Harbour development power  ³Ü
ECHO ³ (c) FiveTech 1993-2017 for Microsoft Windows 9X/NT/200X/ME/XP/Vista/7/8/10 ³Û
ECHO ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙÛ
ECHO ÿ ßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßß

if A%1 == A GOTO :SINTAX
if NOT EXIST %1.prg GOTO :NOEXIST

if "%FWDIR%" == "" set FWDIR=.\..
if "%HBDIR%" == "" set HBDIR=c:\HB1612
rem if "%2" == "/b" set GT=gtwin
rem if not "%2" == "/b" set GT=gtgui
set GT=gtgui

ECHO Compiling...

set hdir=%HBDIR%
set hdirl=%hdir%\lib
set fwh=%FWDIR%
if exist c:\bcc7 set bcdir=c:\bcc7
if exist c:\bcc64 set bcdir=c:\bcc64

%hdir%\bin\harbour %1 /n /i%fwh%\include;%hdir%\include /w /p %2 %3 > comp.log 2> warnings.log
if errorlevel 1 goto COMPILEERRORS
@type comp.log
@type warnings.log

echo -O2 -e%1.exe -I%hdir%\include -I%bcdir%\include %1.c > b32.bc
%bcdir%\bin\bcc32 -M -c @b32.bc
:ENDCOMPILE

IF EXIST %1.rc %bcdir%\bin\brc32.exe -r -I%bcdir%\include -I%bcdir%\include\windows\sdk %1
rem IF EXIST %1.rc %bcdir%\bin\cgrc.exe -r -m -I%bcdir%\include -I%bcdir%\include\windows\sdk %1
rem IF EXIST %1.rc %vcdir%\bin\rc -r -d__FLAT__ %1

echo %bcdir%\lib\c0w32.obj + > b32.bc
echo %1.obj, + >> b32.bc
echo %1.exe, + >> b32.bc
echo %1.map, + >> b32.bc
echo %fwh%\lib\FiveH.lib %fwh%\lib\FiveHC.lib %fwh%\lib\libmysql.lib + >> b32.bc
echo %hdirl%\hbwin.lib + >> b32.bc
echo %hdirl%\gtgui.lib + >> b32.bc
echo %hdirl%\hbrtl.lib + >> b32.bc
echo %hdirl%\hbvm.lib + >> b32.bc
echo %hdirl%\hblang.lib + >> b32.bc
echo %hdirl%\hbmacro.lib + >> b32.bc
echo %hdirl%\hbrdd.lib + >> b32.bc
echo %hdirl%\rddntx.lib + >> b32.bc
echo %hdirl%\rddcdx.lib + >> b32.bc
echo %hdirl%\rddfpt.lib + >> b32.bc
echo %hdirl%\hbsix.lib + >> b32.bc
echo %hdirl%\hbdebug.lib + >> b32.bc
echo %hdirl%\hbcommon.lib + >> b32.bc
echo %hdirl%\hbpp.lib + >> b32.bc
echo %hdirl%\hbcpage.lib + >> b32.bc
echo %hdirl%\hbcplr.lib + >> b32.bc
echo %hdirl%\hbct.lib + >> b32.bc
echo %hdirl%\hbpcre.lib + >> b32.bc
echo %hdirl%\xhb.lib + >> b32.bc
echo %hdirl%\hbziparc.lib + >> b32.bc
echo %hdirl%\hbmzip.lib + >> b32.bc
echo %hdirl%\hbzlib.lib + >> b32.bc
echo %hdirl%\hbzebra.lib + >> b32.bc
echo %hdirl%\minizip.lib + >> b32.bc
rem echo %hdirl%\png.lib + >> b32.bc
echo %hdirl%\hbusrrdd.lib + >> b32.bc
echo %hdirl%\hbtip.lib + >> b32.bc

rem Uncomment these two lines to use Advantage RDD
rem echo %hdirl%\rddads.lib + >> b32.bc
rem echo %hdirl%\Ace32.lib + >> b32.bc

echo %fwh%\lib\dolphin.lib + >> b32.bc
rem echo %fwh%\lib\libmysql.lib + >> b32.bc

echo %bcdir%\lib\cw32.lib + >> b32.bc
echo %bcdir%\lib\uuid.lib + >> b32.bc
echo %bcdir%\lib\import32.lib + >> b32.bc
echo %bcdir%\lib\ws2_32.lib + >> b32.bc
echo %bcdir%\lib\psdk\odbc32.lib + >> b32.bc
echo %bcdir%\lib\psdk\nddeapi.lib + >> b32.bc
echo %bcdir%\lib\psdk\iphlpapi.lib + >> b32.bc
echo %bcdir%\lib\psdk\msimg32.lib + >> b32.bc
echo %bcdir%\lib\psdk\psapi.lib + >> b32.bc
echo %bcdir%\lib\psdk\rasapi32.lib + >> b32.bc
echo %bcdir%\lib\psdk\gdiplus.lib + >> b32.bc
echo %bcdir%\lib\psdk\shell32.lib, >> b32.bc

IF EXIST %1.res echo %1.res >> b32.bc
if %GT% == gtwin %bcdir%\bin\ilink32 -Gn -Tpe -s @b32.bc
IF ERRORLEVEL 1 GOTO LINKERROR
if %GT% == gtgui %bcdir%\bin\ilink32 -Gn -aa -Tpe -s @b32.bc
IF ERRORLEVEL 1 GOTO LINKERROR
ECHO * Application successfully built *
rem signtool.exe sign /fd sha256 %1.exe
%1
GOTO EXIT
ECHO

rem delete temporary files
@del %1.c

:COMPILEERRORS
@type comp.log
@type warnings.log
ECHO * Compile errors *
GOTO EXIT

:LINKERROR
ECHO * Linking errors *
GOTO EXIT

:SINTAX
ECHO    SYNTAX: Build [Program]     {-- No especifiques la extensi¢n PRG
ECHO                                {-- Don't specify .PRG extension
GOTO EXIT

:NOEXIST
ECHO The specified PRG %1 does not exist

:EXIT
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7848
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: qrcode

Postby karinha » Tue Aug 01, 2017 4:05 pm

Silvio.Falconi wrote:ok resolved !!
linked hbzebra.lib
and I check with my smarthphone ( qrcode reader ) ....run ok :D


Very good!!
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7848
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: qrcode

Postby betoncu » Tue Aug 01, 2017 4:07 pm

I am using the tcodebars.prg, hbzebra.ch and codebar.ch files below, but I dont remeber now where I have found them.
Also you have to link hbzebra.lib.

Code: Select all  Expand view  RUN
#include "fivewin.ch"
#include "codebar.ch"

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
 


Code: Select all  Expand view  RUN
// 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_QRCODE         14

#define CODEBAR_TYPE           1
#define CODEBAR_BLOCK          2

#define DEFAULT_CODEBAR        CODEBAR_PDF417
 


Code: Select all  Expand view  RUN
/*
 * Harbour Project source code:
 * Zebra barcode library
 *
 * Copyright 2010 Mindaugas Kavaliauskas <dbtopas at dbtopas.lt>
 * www - http://harbour-project.org
 *
 * 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 http://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.
 *
 */


/* NOTE: This file is also used by C code. */

#ifndef HB_ZEBRA_CH_
#define HB_ZEBRA_CH_

/* Barcode types */
#define HB_ZEBRA_TYPE_EAN13                 1
#define HB_ZEBRA_TYPE_EAN8                  2
#define HB_ZEBRA_TYPE_UPCA                  3
#define HB_ZEBRA_TYPE_UPCE                  4
#define HB_ZEBRA_TYPE_CODE128               5
#define HB_ZEBRA_TYPE_CODE93                6
#define HB_ZEBRA_TYPE_CODE39                7
#define HB_ZEBRA_TYPE_CODE11                8
#define HB_ZEBRA_TYPE_CODABAR               9
#define HB_ZEBRA_TYPE_ITF                   10
#define HB_ZEBRA_TYPE_MSI                   11

#define HB_ZEBRA_TYPE_PDF417                257
#define HB_ZEBRA_TYPE_DATAMATRIX            258
#define HB_ZEBRA_TYPE_QRCODE                259

/* Generate errors */
#define HB_ZEBRA_ERROR_INVALIDCODE          1
#define HB_ZEBRA_ERROR_BADCHECKSUM          2
#define HB_ZEBRA_ERROR_TOOLARGE             3
#define HB_ZEBRA_ERROR_ARGUMENT             4

/* Draw errors */
#define HB_ZEBRA_ERROR_INVALIDZEBRA         101

/* Generate flags */
#define HB_ZEBRA_FLAG_CHECKSUM              1
#define HB_ZEBRA_FLAG_WIDE2                 0x00  /* Dummy flag - default */
#define HB_ZEBRA_FLAG_WIDE2_5               0x40
#define HB_ZEBRA_FLAG_WIDE3                 0x80

/* Draw flags */

/* Barcode dependent flags */
#define HB_ZEBRA_FLAG_PDF417_TRUNCATED      0x0100
#define HB_ZEBRA_FLAG_PDF417_LEVEL_MASK     0xF000
#define HB_ZEBRA_FLAG_PDF417_LEVEL0         0x1000
#define HB_ZEBRA_FLAG_PDF417_LEVEL1         0x2000
#define HB_ZEBRA_FLAG_PDF417_LEVEL2         0x3000
#define HB_ZEBRA_FLAG_PDF417_LEVEL3         0x4000
#define HB_ZEBRA_FLAG_PDF417_LEVEL4         0x5000
#define HB_ZEBRA_FLAG_PDF417_LEVEL5         0x6000
#define HB_ZEBRA_FLAG_PDF417_LEVEL6         0x7000
#define HB_ZEBRA_FLAG_PDF417_LEVEL7         0x8000
#define HB_ZEBRA_FLAG_PDF417_LEVEL8         0x9000

#define HB_ZEBRA_FLAG_DATAMATRIX_SQUARE     0x0100
#define HB_ZEBRA_FLAG_DATAMATRIX_RECTANGLE  0x0200

#define HB_ZEBRA_FLAG_QR_LEVEL_MASK         0x0700
#define HB_ZEBRA_FLAG_QR_LEVEL_L            0x0100
#define HB_ZEBRA_FLAG_QR_LEVEL_M            0x0200
#define HB_ZEBRA_FLAG_QR_LEVEL_Q            0x0300
#define HB_ZEBRA_FLAG_QR_LEVEL_H            0x0400

#endif /* HB_ZEBRA_CH_ */
 
Birol Betoncu
birol.betoncu@gmail.com
Using Harbour, FWH 19.05, BCC7
User avatar
betoncu
 
Posts: 126
Joined: Sat Oct 08, 2005 9:38 pm
Location: Cyprus (North)

Re: qrcode

Postby Silvio.Falconi » Tue Aug 01, 2017 4:18 pm

wht pdf47 is remmed ?
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 7076
Joined: Thu Oct 18, 2012 7:17 pm

Re: qrcode

Postby Silvio.Falconi » Tue Aug 01, 2017 4:56 pm

ANOTHER PROBLEM
for codebar i cannot print the code over the barcode

sample : on this picture I use vrdbarcode class


and here in italy this code is used for shop market 's articles
Last edited by Silvio.Falconi on Fri Feb 02, 2018 2:45 pm, edited 1 time in total.
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 7076
Joined: Thu Oct 18, 2012 7:17 pm

Re: qrcode

Postby karinha » Tue Aug 01, 2017 5:27 pm

João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7848
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 37 guests