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 Windows SDK with PowerBuilder


Using Sentry Windows SDK with PowerBuilder

Product: Sentry Spelling Checker Engine Windows SDK

The following information may help customers who need to integrate Sentry Spelling Checker Engine into a PowerBuilder application.

Contents:

Function declarations

Sentry API functions documented in the Sentry Programmer's Guide are shown in C/C++ syntax. The following table shows how to translate C/C++ data types into PowerBuilder data types:

C/C++ type

Type description

C/C++ example

Equivalent PowerBuilder type

PowerBuilder Example

char *

String, or more accurately, pointer to an array of characters

char *fileName
ref String
ref String fileName
SSCE_CHAR *

String, or more accurately, pointer to an array of Latin 1 characters (i.e., text being spell-checked)

SSCE_CHAR *errWord
ref String
ref String errWord
SSCE_S16

Signed, 16-bit integer

SSCE_S16 blkId
integer
integer blkId
SSCE_S16 *

Pointer to a signed, 16-bit integer ("pointer" meaning "pass by reference")

SSCE_S16 *format
ref integer
ref integer format
SSCE_S32

Signed, 32-bit integer

SSCE_S32 strLen
long
long strLen
SSCE_S32 *

Pointer to a signed, 32-bit integer ("pointer" meaning "pass by reference")

SSCE_S32 *cursor
ref long
ref long cursor
SSCE_U16

Unsigned, 16-bit integer

SSCE_U16 fileNameSz
integer
integer fileNameSz
HWND

Window handle

HWND parentWin
ulong
ulong parentWin
HINSTANCE

Instance handle

HINSTANCE clientInst
ulong
ulong clientInst

For pointer-type parameters (denoted by "*", as in SSCE_CHAR *str) the keyword "const" indicates that the parameter is passed by reference but will not be modified by the called function. If "const" is missing, the parameter is either an output parameter (meaning it is modified to by the called function) or an input/output parameter (meaning its value is read by the called function and may be modified by the called function). PowerBuilder has no equivalent, so the "const" keyword can be omitted, but you should be aware of its meaning.

Following are some example function declarations:

(Note that references to SSCE5532.DLL should be changed to the name of the Sentry DLL included with your version of the Sentry Windows SDK.)

NOTE: PowerBuilder must be configured to pass ANSI (single-byte) strings to the Sentry DLL. Passing Unicode strings will not work.

About the Sentry license key (Version 5.15 and earlier)

In Sentry Windows SDK version 5.15 and earlier, the license key is provided as a hexadecimal constant. Unfortunately, PowerBuilder lacks a means for expressing hexadecimal constants, so the license key must be converted to decimal before it can be passed to the SSCE_SetKey function. Convert your license key from hexadecimal to decimal using a hex-capable calculator (if you don't have one, use the Windows calculator in "Scientific" mode). For example, 1234ABCD hexadecimal is 305441741 decimal. If the hexadecimal key begins with 8, 9, A, B, C, D, E or F, convert it to a negative decimal number by subracting 4294967296 (decimal) after converting your key to decimal. For example, if your key is ABCD1234 hexadecimal, convert it to decimal: 2882343476. Because the key starts with "A," subtract 4294967296: -1412623820.

Note that in Sentry Windows SDK 5.16 and later, the license key is provided as a long decimal integer, so conversion is not necessary. Pass the key provided by Wintertree Software to the SSCE_SetKey function as-is.

Interactively checking text in a multi-line edit control

If you want to check the text in a multi-line edit control (named myMLE in this example), follow these instructions.

First, declare the following local (or global) external functions:

Function integer SSCE_SetKey(long key) library "SSCE5532.DLL"
Function integer SSCE_CheckCtrlDlg(ulong parentWin, ulong ctrlWin, integer selectedOnly) library "SSCE5532.DLL"

Next, insert statements similar to the following in an event handler (e.g., in response to a menu selection or button press:

ulong ull_key = 305441741  /* Sentry license key converted to decimal */
long ll_rc
ll_rc = SSCE_SetKey(ull_key)
ll_rc = SSCE_CheckCtrlDlg(Handle(This), Handle(myMLE), 0)

Invoke the event handler to which you added the call to SSCE_CheckCtrlDlg. You should see the spelling-checker dialog box.


Home Site index Contact us Catalog Shopping Cart Products Support Search


Copyright © 2003 Wintertree Software Inc. Last modified