Menu

MaxiCode ActiveX Methods



AboutBox Method
Opens an About window.

Syntax
object.AboutBox()
Return Value
No return value.



SaveToImageFile Method
Saves the image of the barcode to a file.

Syntax
object.SaveToImageFile(cx, cy, sFileName, [lRes,] [dm])
Parameters
cxA double that defines the barcode picture width.
cyA double that defines the barcode picture height.
sFileNameA string expression defining the file name.
lResOptional (default 0). A long value that sets the picture resolution.
dmOptional (default dmPixels). This value defines the units that should be used to specify cx and cy. See remarks.

If the parameter cx or cy are equal to 0, the picture is stored in the default resolution (300 dpi) and has nominal width and height.
The nominal dimensions of a MaxiCode barcode must be 26.38 x 25.39 mm.
Return Value
No return value.
Remarks
The format the file will be saved in depends on the extension of the file name For example, if you specify sFileName as "img1.jpg", the barcode will be saved as JPEG.
The following extensions can be used - "wmf", "emf", "bmp", "jpg", "jpeg", "gif", "tiff" and "png".

The dm parameter may has the following values:
dmMils = 0, mils(0.001 inches)
dmInches = 1, inches
dmMM = 2, millimeters
dmPixels = 3, pixels

If the size of an image (cx, cy) is not specified in pixels, its actual size will be calculated using the specified picture resolution - lRes.

Warning! For this method to function properly, you should have the GDI+ library (gdiplus.dll) installed on your PC, this library is distributed with Windows XP and higher. if you do not have this library, you can download it here, and copy it to the folder "../Windows/System32/".
Examples
'1.
'Save the image to a file of the JPEG format. The size of the image will be 100x100 pixels with the resolution of 96 dpi.

Call MaxiCodeCtrl1.SaveToImageFile(0, 0, "c:\maxicode.jpg", 300, dmPixels)

'2.
'Save the image to a file of the JPEG format. The size of the image will be 30x30 millimeters with the resolution of 300 dpi.

Call MaxiCodeCtrl1.SaveToImageFile(26.38, 24.37, "c:\maxicode.jpg", 600, dmMM)



CopyToClipboard Method
Copies the image of the barcode onto the clipboard. After that you can insert this image into your program using Ctrl+V or the Paste menu item.

Syntax
object.CopyToClipboard(cx, cy)
Parameters
cxAn integer value that defines the barcode picture width
cyAn integer value that defines the barcode picture height
Return Value
No return value.



DrawBarcodeToSize Method
Draws the barcode in the device context. You can use either printer or screen as the device context.

Syntax
object.DrawBarcodeToSize(X, Y, CX, CY, dm, [hDC])

Parameters

XA double value that defines the X coordinate of the barcode.
YA double value that defines the Y coordinate of the barcode.
CXA double that defines the barcode width.
CYA double that defines the barcode height.
dmOptional (default dmPixels). This value defines the units that should be used to specify cx and cy. See here.
hDCOptional (default 0). The handle of the device context where the barcode will be drawn. If this parameter is not specified or set to zero, the printer device context will be used.

Return Value

No return value.
Examples
'Draw a MaxiCode to a screen.
Call MaxiCodeCtrl1.DrawBarcodeToSize(0, 0, 26.38, 25.39, dmMM, Form1.hDC)


'Print a maxicode
Printer.CurrentX = 2048
Printer.Print "BarcodeTools.com, MaxiCode VB Example"
Call MaxiCodeCtrl1.DrawBarcodeToSize(10, 10, 26.38, 25.39, _
  dmMM, Printer.hDC)
Printer.EndDoc



BeginPrint Method
Opens access to a printer.

Syntax
object.BeginPrint(sPrinterName)
Parameters
sPrinterNameA string value that defines the name of the printer. The name of the printer can be determined in the Printer folder of the Control Panel.
If the name is blank, the default printer will be opened.
Return Value
No return value.
Remarks
This function must be called first before other printing features are used.



EndPrint Method
Closes the printer. You cannot use any printing features after that.

Syntax
object.EndPrint()
Return Value
No return value.



NewPage Method
The StartPage function prepares the printer driver to accept data.

Syntax
object.NewPage()
Return Value
No return value.



EndPage Method
The EndPage function notifies the device that the application has finished writing to a page. This function is typically used to direct the device driver to advance to a new page.

Syntax
object.EndPage()
Return Value
No return value.



GetPrinterHDC Method
The function returns the handle of the printer previously opened with the help of the BeginPrint function.

Syntax
object.GetPrinterHDC()

Return Value
HDC



SetPrinterHDC Method
Defines the handle of the printer that will be used for printing. If this function is called, you do not have to call BeginPrint. In this case the entire process of closing/opening the printer, etc. will be controlled outside the DataMatrix ActiveX Control.

Syntax
object.SetPrinterHDC(hDC)
Parameters
hDCValue that specifies the printer handle.
Return Value
No return value.
Example
Printer.CurrentX = 2048
Printer.Print "BarcodeTools.com, VB Example"

'MaxiCode-ActiveX will use the Visual Basic Printer object
Call MaxiCodeCtrl1.SetPrinterHDC(Printer.hDC)

'print the barcodes
Call MaxiCodeCtrl1.DrawBarcodeToSize(10, 10, 26.38, 25.39, dmMM)
Call MaxiCodeCtrl1.DrawBarcodeToSize(70, 10, 26.38, 25.39, dmMM)

Printer.EndDoc



BinaryWritePicture Method
This method is similar to SaveToImageFile, but instead of saving the image to a file it represents it as a byte array.

Syntax
object.BinaryWritePicture(sFmt, CX, CY)

Parameters

sFmtString that specifies the file name extension.
The following extensions can be used - "wmf", "emf", "bmp", "jpg", "jpeg", "gif", "tiff" and "png".
CXA integer that defines the barcode width
CYA integer that defines the barcode height

Return Value

Variant that specifies safe array of the bytes.
Remarks
This method can be useful for sending the image over the Internet. For example, it can be used by the IIS server.

Warning! For this feature to function properly, you should have the GDI+ library (gdiplus.dll) installed on your PC, this library is distributed with Windows XP and higher. if you do not have this library, you can download it here, and copy it to the folder "../Windows/System32/".

Example
There is a short example of the ASP page distributed together with MaxiCode ActiveX Control.
<%
' (c) 1999-2009 www.BarcodeTools.com

' we are sending a GIF image to the client
Response.ContentType = "image/gif"
Response.BinaryWrite Barcode.BinaryWritePicture("gif", 200, 200)

SET Barcode=nothing
%>