The SpellMate library (SPELMATE.DLL) can be used directly from
Microsoft's Visual Basic with no problems. Simply include the
module SpelMate.BAS into your project window and you will have
access to the SpellMate routines directly or, for a much easier
life, a set of Visual Basic Subs which provide a simple
interface to SpellMate.
The SpelMate.BAS module contains declarations for the DLL
routines and some Visual Basic code to allow direct checking of the contents of any TextBox control on a Visual Basic form. There is no need to access the DLL routines directly at all, unless you wish to provide a more efficient parser than the one supplied in the module. In fact, SpellMate can be used with only a few lines of code in a Visual Basic program. There are two example programs on the disk which illustrate the use of SpellMate.
VBSPLMIN.MAK This is a program which contains the
absoulte minimum of code needed to
use SpellMate. It's project file
includes :-
VBSPELMIN.FRM The main form.
SPELMATE.BAS The SpellMate module.
SPELTEST.MAK This is a program which includes a
simple text editor with spell checking
facilities. It's project file
includes :-
SPELMATE.BAS The SpellMate module.
GETFILE.FRM A file load form.
SAVEFILE.FRM A file save form.
SPELTEST.FRM The main form.
SPELTEST.BAS Global variables.
Using SpellMate from Visual Basic.
==================================
To use SpellMate from a Visual Basic program, there are a few
simple requirements. You must have SPELMATE.DLL, MAINUK.DIC
and PRIVATE.DIC all in the same directory on your path (e.g.
the Windows directory).
If you intend to use the DLL routines directly, you need to
import the Declarations section of SPELMATE.BAS, which informs
the Visual Basic program of the interface requirements for each
function. Call the function as declared. In particular, you
must use the SuggestVBWord function rather than the SuggestWord
function, because the latter does not know about Visual Basic
strings. When calling this function, you must send a fixed
length string as a parameter (e.g. declared as :-
Dim S As String * NN,
where NN is the number of characters), with at least 20
characters in it, and the truncate the trailing spaces from it
when it returns (use Trim$()). See the contents of
DoSpellCheck in SPELMATE.BAS for more details.
Otherwise, you need to import SPELMATE.BAS by adding it to your
project window, and have the text to be spell checked in a
TextBox control which has the HideSelect property set to False.
To do a spell check, set the text insertion point in the text
box at the point from which you want to start checking
(using the SelStart property or moving the cursor manually)
and then call DoSpellCheck, passing the name of the Text Box
as a parameter. e.g. for a form with a TextBox called T :-
' ' '
T.Text = "Text to be spell checked."
T.SelStart = 1
DoSpellCheck T
On return, the Text property of the text box is updated with
the suggestions which were accepted.
Have fun using SpellMate,
Alistair McMonnies,
Lecturer and Developer,
Microelectronics Educational Development Centre,
University of Paisley
July 1993.
P.S. Bug Fix...
Version 1 of the SPELMATE.BAS file had a bug which caused
the program to crash if the spell text in SPELTEST.BAS was done
from the cursor position when the cursor was at the beginning of
the text file. This has now been fixed - apologies to all those