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 C#


Using Sentry Windows SDK with C#

Product: Sentry Spelling Checker Engine Windows SDK, Version 5.15 and earlier

The following declarations may help customers who need to integrate Sentry Spelling Checker Engine into a C# application.

Sentry Windows SDK version 5.16 and later includes a C# class (located in ssce\sdk\c#\ssce.cs) that provides C# declarations for Sentry's API.

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 C# data types:

C/C++ type

Type description

C/C++ example

Equivalent C# type

C# Example

const char *

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

const char *fileName
[MarshalAs(UnmanagedType.LPStr)] string
[MarshalAs(UnmanagedType.LPStr)]
string fileName
const SSCE_CHAR *

Input string, or more accurately, pointer to a null-terminated array of Latin 1 characters (e.g.., text being spell-checked)

const SSCE_CHAR *text
[MarshalAs(UnmanagedType.LPStr)] string
[MarshalAs(UnmanagedType.LPStr)]
string text
char *

Output string.

char *fileName
[MarshalAs(UnmanagedType.LPStr)] StringBuilder
[MarshalAs(UnmanagedType.LPStr)] StringBuilder fileName
SSCE_CHAR *

Output string, or more accurately, pointer to an array of Latin 1 characters

SSCE_CHAR *errWord
[MarshalAs(UnmanagedType.LPStr)] StringBuilder
[MarshalAs(UnmanagedType.LPStr)] StringBuilder errorWord
SSCE_S16

Signed, 16-bit integer

SSCE_S16 sid
short
short sid
SSCE_S16 *

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

SSCE_S16 *format
ref short
ref short format
SSCE_S32

Signed, 32-bit integer

SSCE_S32 strLen
int
int strLen
SSCE_S32 *

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

SSCE_S32 *cursor
ref int
ref int cursor
SSCE_U16

Unsigned, 16-bit integer

SSCE_U16 fileNameSz
ushort
ushort fileNameSz
HWND

Window handle

HWND parentWin
Int32
Int32 parentWin
HINSTANCE

Instance handle

HINSTANCE clientInst
Int32
Int32 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).

By default, C# uses wide (2-byte) character strings, but the Sentry DLL uses single byte strings. For this reason, the [MarshalAs(UnmanagedType.LPStr)] modifier should be applied to string-type parameters (both input and output).

Following are some example function declarations:

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

For more information on calling DLLs from C#, search MSDN for "Platform Invoke Tutorial."


Home Site index Contact us Catalog Shopping Cart Products Support Search


Copyright © 2015 Wintertree Software Inc.