Introduction
To assist our customers integrating barcode fonts with their
own applications, we provide a series of source code written in
a variety of languages, such as Visual Basic, VBA, VBScript,
C/C++, Delphi, FoxPro and JavaScript. You are allowed to import
and modify these source code to fit your applications.
However, some customers asked to be provide a Windows DLL for
their programming environment. This benefits some old
applications which accept only DLL interfaces.
This Windows DLL applies to the following font products:
Code39,
Code39 Full ASCII,
Code93,Code128,
code25,
Code11,
Codabar,
I2of5,
UPC/EAN/Bookland, US Postal,
RoyalMail and
Telepen. Other font products,
such as OCR,
MICR E-13B and
CMC7, require no check digit
calculation at all.
This Windows DLL does not apply to 2D symbology font products
such as PDF417 Fontware and
DataMatrix Fontware. Contact
support@morovia.com to
get the DLL version of the encoders.
The Windows DLL is included in the Morovia Font Tools which
can be downloaded from
here.
Function Prototypes
The function prototypes are the same as the ones in other
languages. Click here for the list of the function prototypes.
How to use DLL functions in Visual Basic
We recommend you place our DLL under the Windows directory,
or you can place the DLL under the same folder of your
application. In either case you need to make sure that the DLL
is searchable in your application.
Declaring a DLL procedure
The first step is to declare the procedure in the
Declarations section of a module:
Private Declare Function Code128Ex Lib "MrvFontTools" _ Alias "Code128Ex" _
( ByRef lpString As String) As String
To get the definition of the function, refer to the function
prototype. If you place the Declare in a Form or Class module,
you must precede it with the Private keyword. You only need to
declare the function once per project; you can then call it any
number of times.
Calling a DLL procedure
After the function is declared, you call it just as you would
a standard Visual Basic function. Here, the procedure has been
attached to the Form Load event:
Private Sub Form_Load() TextBox1.Text = Code128Ex("00001344556") End Sub
When this code is run, the function first calculates the
barcode string for the specified data in Code128 format. If the
text box is formatted with appropriate Code128 font, a code128
barcode will appears on the form.
How to Use DLL functions in C/C++
There are two ways to use DLL functions in C/C++. The first
method is to use an import library file. If you are working on
this approach, write to
support@morovia.com to obtain a C/C++ header file and the
import library. Compile your application and link with the
import lib. Another robust way is to dynamically load the DLL
into the memory, obtain the function address and call the
function. The following code demonstrates how to:
#include <windows.h>
#include <iostream.h>
#include <stdio.h>
#include <conio.h>
#define MAXMODULE 50
typedef char* (WINAPI*cfunc)(const char*);
cfunc encode_func;
void main() {
HINSTANCE hLib=LoadLibrary("MrvFontTools.DLL");
if(hLib==NULL) {
cout << "Unable to load library!" << endl;
getch();
return;
}
encode_func=(cfunc)GetProcAddress((HMODULE)hLib, "Code128Ex");
char* p = encode_func("0001233000");
FreeLibrary((HMODULE)hLib);
getch();
}
|