Group 1 calls use the BARCODE2D structure to pass data to and from the DLL.
The prototypes of the library calls are:
int WINAPI Bar2DInf(HANDLE hModule, int itype,LPBAR2D bc)
where
hModule is the Module handle of the calling application.
itype is the barcode type index (0-27), and
bc is a long pointer to a BARCODE structure.
Calls to Bar2DInf 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 list box with the barcode type names, and for checking whether a specific number of characters is required to generate a valid code image.
LPHANDLE WINAPI Bar2Dm(HANDLE hModule, LPRECT lpRectIn, LPBAR2D bc, LPHANDLE &hmf, LPSTR szPat)
where
hModule is the Module handle of the calling application
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).
bc is a BARCODE2D structure - the LPBAR2D 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 or alternate characters representing the lengths of bars and spaces. This value may be NULL if the string is not required, or a pointer to a buffer such as
char szPat[4096];
before calling the library routines - even if you do not intend to use the pattern. For very large barcodes it may be necessary to increase the size of this buffer to 8k or even 16k. For information on the pattern string see the 2D Barcodes Help file.
Calls to Bar2Dm create the barcode metafile image and the image pattern (for developers who wish to draw their own bars), returning an error code in the barcode2d structure in the event of an error.
LPHANDLE WINAPI Bar2Dmx(HDC hDCref, HANDLE hInstance, LPRECT lpRectin,LPBAR2D bcCode,LPHANDLE hemf,LPSTR szPat);
where
hDCref is a reference device context
hModule is the Module handle of the calling application
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).
bc is a BARCODE2D structure - the LPBAR2D cast is required.
hemf is a HENHMETAFILE handle that will contain the handle of the enhanced 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 either be declared as
char szPat[4096];
before calling the library routines - or passed as NULL – in which case no pattern is returned. For very large barcodes it may be necessary to increase the size of this buffer to 8k or even 16k. For information on the pattern string see the 2D Barcodes Help file.
Calls to Bar2Dmx create the barcode enhanced metafile image and the image pattern (for developers who wish to draw their own bars), returning an error code in the barcode2d structure in the event of an error.
LPHANDLE WINAPI Bar2Db(HANDLE hModule, LPBAR2D bc, int iMult, LPHANDLE &hbm)
where
hModule is the Module handle of the calling application
bc is a BARCODE2D structure - the LPBAR2D cast is required.
iMult is a pixel-scaling factor and in this release should be set to 0 or 1.
hbm is a HBITMAP handle that will contain the handle of the bitmap image on return.
Calls to Bar2Db create the barcode bitmap image, returning an error code in the barcode2d structure in the event of an error.
The Bar2Db3 function is provided for creating bitmap images of a specified resolution.
LPHANDLE WINAPI Bar2Dd(HANDLE hModule, LPBAR2D bc, int iMult, LPHANDLE &hdib)
This call is virtually the same as that to Bar2Db() except that the handle returned and in hdib is a handle to a Device Independent Bitmap.
The Bar2Dd3 function is provided for creating device independent bitmap images of a specified resolution.
Int WINAPI Bar2Dc(LPRECT rect, LPBAR2D bc)
Calls to Bar2Dc causes a barcode image to be created on the Windows clipboard for easy return to Visual Basic (version 5 or later) or other applications.
int WINAPI Bar2Df(HANDLE hModule, LPRECT lpRectin, LPBAR2D bc, LPSTR szFileName);
where
hModule is the Module handle of the calling application
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).
bc is a BARCODE2D structure - the LPBAR2D cast is required.
szFileName is a fully qualified filename for a file that will be created to receive the image of the barcode. The type of image saved is determined by the filename extension. The allowed extensions are:
.WMF – Windows metafile
.BMP – Windows bitmap
.PCX –
Paintbrush file
.EPS – Encapsulated PostScript
.PNG – Portable Network
Graphics
.GIF – GIF file (requires Unisys GIF licence)
The Bar2Df function saves a barcode image to the specified file.
Note that graphic files based on bitmaps should have a target resolution specified by calling SetBitmapScale() before saving the file.
int WINAPI Bar2Df2(HDC hDCref, HANDLE hModule, LPSIZE lps, LPBAR2D bc, LPSTR szFileName);
where
hDCref is reference device context for which the bitmap-based barcode image will be generated.
hModule is the Module handle of the calling application
lps is a long pointer to a SIZE structure that is the required size for the barcode image (with coordinates in units of 0.01 mm).
bc is a BARCODE2D structure - the LPBAR2D cast is required.
szFileName is a fully qualified filename for a file that will be created to receive the image of the barcode. The type of image saved is determined by the filename extension. The allowed extensions are:
.BMP – Windows bitmap
.PCX – Paintbrush file
.EPS –
Encapsulated PostScript
.PNG – Portable Network Graphics
.GIF – GIF file
(requires Unisys GIF licence)
The Bar2Df2 function generates a bitmap-type barcode image suitable for reproduction on the hDCref device context at the size specified in the lps size. This function does not generate metafile picture files.
int WINAPI Bar2Dh(HDC hDC, HANDLE hModule, LPRECT lpRectInL, LPBAR2D bc, LPSTR szPat);
Calls to Bar2Dh draw the barcode image into the specified device context, with other parameters as defined for Bar2Dm.
where
hDC is the target device context
hModule is the Module handle of the calling application
lpRectIn is a long pointer to a rectangle that is the destination rectangle for the barcode image. If all coordinates of the rectangle are provided these should be in Device coordinates and the image fits within the rectangle. If the rect.right value is 0, then the top and left coordinates are taken to be in HIMETRIC units (0.01 mm), measured from the top left of the device context, and the image is rendered using the size determined from the xunit and yunit values (also which are specified in Mil units).
Users of the MFC Print Preview facility should note that scaling is required when using this call. Bar2Dm is simpler to use for this purpose.
bc is a BARCODE2D structure - the LPBAR2D cast is required.
szPat if a long pointer to a string that receives a pattern of 0s and 1s representing spaces and bars respectively. This variable must either be declared as
char szPat[4096];
before calling the library routines – or passed as NULL – in which case no pattern is returned. For very large barcodes it may be necessary to increase the size of this buffer to 8k or even 16k. For information on the pattern string see the 2D Barcodes Help file.
Calls to Bar2Dh draws the barcode image on the specified device context and returns the image pattern (for developers who wish to draw their own bars or derive information about the number of elements), returning an error code in the barcode2D structure in the event of an error.
int WINAPI Bar2Dh2(HDC hDC, HANDLE hModule, LPPOINT lp, LPBAR2D bc)
Calls to Bar2Dh2() are similar to Bar2Dh() except that the lp parameter points to the coordinates of the top left-hand corner of the image in device coordinates, and the size of the image is determined by the values specified in the bc structure.
int
WINAPI Bar2Dh3(HDC hDC, LPRECT lpr, LPBAR2D bc,
BOOL bPrinting,
int xRes, int yRes);
where hDC is the target device context,
lpr is a pointer to the target rectangle in HIMETRIC units
bc is a BARCODE2D structure - the LPBAR2D cast is required.
bPrinting is true if the output is to a printer or false otherwise
xRes and yRes are the horizontal and vertical resolutions of the target printer
This function produces barcode images in which the bar widths are whole numbers of pixels of the target printer as defined by the resolutions xRes and yRes; as the bars are aligned to pixels the width of the barcode may not be exactly as expected.
More: