Group 1 Library calls

Group 1 calls allow the programmer to generate barcode from a Barcode structure. The prototypes of the library calls are:

LPHANDLE WINAPI BarCodem(HMODULE hInstance, LPRECT lpRectIn, LPLOGFONT lpLogFontIn, LPBAR bc, LPHANDLE &hmf, LPSTR szPat)

where

hInstance is the instance (Module) handle of the calling application. This value may be 0, but may alternatively be obtained by calling the GhDlsbar() function.

lpRectIn is a long pointer to a rectangle that is the destination rectangle for the barcode image (with coordinates in units of 0.01 mm).

lpLogFontIn is a long pointer to a LOGFONT structure filled with information about the font with which any text will be displayed on the barcode. The font height will be treated as Points and treated as positive.

bc is a BARCODE structure - the LPBAR cast is required.

hmf is a HMETAFILEPICT handle that will contain the handle of the metafile image on return.

szPat if a long pointer to a string that receives a pattern of 0s and 1s representing spaces and bars respectively. This variable must be declared as

char szPat[4096];

before calling the library routines - even if you do not intend to use the pattern. If your barcodes are not likely to exceed 12 characters in length, then the pattern string may be declared as szPat[1024].

Calls to BarCodem create the barcode metafile image and the image pattern (for developers who wish to draw their own bars), returning an error code in the barcode structure in the event of an error.

An almost identical call is provided in the 32-bit version of the library for creating enhanced metafiles:

LPHANDLE WINAPI BarCodemx(HCD hDCRef, HMODULE hInstance, LPRECT lpRectIn, LPLOGFONT lpLogFontIn, LPBAR bc, LPHANDLE &hmf, LPSTR szPat)

where the only difference from Barcodem is the handle hmf and the handle returned are HENHMETAFILE type (ie. refer to Enhanced metafiles).hDCRef is a reference device context for the enhanced metafile; if hDCRef is NULL then the default device context for the system will be used to create the enhanced metafile.

 

int WINAPI BarInfo(HMODULE hInstance, int itype,LPBAR bc)

where

hInstance is the instance handle of the calling application. This value may be 0, but may alternatively be obtained by calling the GhDlsbar() function.

itype is the barcode type index (0-39), and

bc is a long pointer to a BARCODE structure.

Calls to BarInfo with an integer value specifying the barcode type in itype will return bc containing information about that type, including its abbreviated name, nominal length and height (if any), required number of characters (if restricted), check digit (or parity) requirements, alphabetic character support, and whether the code supports or requires a subscript (or supplementary code). This information is useful for filling a listbox with the barcode type names, and for checking whether a specific number of characters are required to generate a valid code image.

BarInfo return a negative value when the code type specified by itype is undefined.

 

int WINAPI BarCodeh2(HDC hDC, HANDLE hInstance, LPPOINT lpPt, LPSIZE lpSz, LPLOGFONT lpLf, LPBAR bc);

where hDC is the target device context,

hInstance is the  instance handle of the calling application (may be 0).

LpPt is a pointer to a POINT structure containing the coordinates of the top left hand corner of the required target area  (in the device coordinates) of the device context.

LpSz is a pointer to a SIZE structure containing the x and y extents (in HIMETRIC units - 0.01 mm) of the barcode image required. (Note that this may be altered if an X unit value is specified in the spare element of the barcode structure.)

LpLF is a long pointer to a LOGFONT structure filled with information about the font with which any text will be displayed on the barcode.  The font height will be treated as Points and treated as positive.

Bc is a barcode structure.

 

int WINAPI BarInit(LPBAR bc)

Where bc is a barcode structure

For initialisation of the members of the barcode structure to default values (code=8 – Code 39).

More:

Additional Group 1 calls