Wintertree Software Inc.

Sentry Spelling Checker Engine - Support

Home Site index Contact us Catalog Shopping Cart Products Support Search

You are here: Home > Support > Sentry Spelling Checker Engine > Using Sentry with Microsoft Access

Using Sentry with Microsoft Access

Product: Sentry Spelling Checker Engine Windows SDK

This document contains information that may be helpful to Microsoft Access developers in adding Sentry Spelling Checker Engine to their applications.

Several functions in Sentry's Windows API, including SSCE_CheckCtrlDlg and SSCE_CheckBackground, require the window handle of the control being checked. Unfortunately, Microsoft Access does not provide a mechanism that allows you to pass the window handle of a text-containing control to the Sentry DLL.

Instead, you can use the SSCE_CheckBlockDlg function. The following example shows how to call SSCE_CheckBlockDlg from Microsoft Access.

Suppose you have a form called Form1. Form1 contains a multi-line text edit control called Memo1 and a button called SpellBtn. Memo1 is bound to a memo field in some table in your application's database. You want the text contained in Memo1 to be spell-checked when the user clicks on SpellBtn.

You can download an example Access database demonstrating this technique here (the example was kindly provided by a customer).

Create a new module (or update an existing module), and add a new function called CheckMemo1:

Delcare Function SSCE_CheckBlockDlg Lib "ssce5532.dll" (ByVal parent&, _
ByVal block$, ByVal blkLen&, ByVal blkSz&, ByVal showContext%) As Long
Declare Function SSCE_SetKey(ByVal key&) As Integer
Function CheckMemo1 () As Integer
Dim text As String
Dim textLen As Long
Dim newLen As Long
  ' Replace 12345678 in the call below to your Sentry license key, provided
' with the Sentry Windows SDK
Call SSCE_SetKey(12345678)
  ' Extract the text from Memo1
text = Forms![Form1]![Memo1]
textLen = Len(text)
  ' Increase the size of the string used to hold the text by 20% to allow room
' for growth.
' 20% is just an arbitrary increment; you may want to add more space.
text = text + String$(textLen / 5, " ")
  ' Check the spelling.
newLen = SSCE_CheckBlockDlg(Forms![Form1].Hwnd, text, textLen, _
Len(text), True)
  ' Replace the text in Memo1. The text will have changed if the user
' corrected misspellings.
If newLen >= 0 Then
Forms![Form1]![Memo1] = Left$(text, newLen)
End If
End Function

Create a macro named CheckMemo1. Add the action RunCode to the macro, and set the Function Name parameter of the RunCode action to CheckMemo1. In Form1, set SpellBtn's OnClick property to CheckMemo1.

To call other functions in Sentry's API, open ssce\sdk\vb\ssce.bas using a text editor such as NotePad. Locate the "Declare" statement for the function you want to call. Copy the declarations you need to the clipboard, and paste them into your module's code where other declarations are placed.

Home Site index Contact us Catalog Shopping Cart Products Support Search

Copyright © 2015 Wintertree Software Inc.