AutoCorrectProc callback function (richedit.h)

The AutoCorrectProc function is an application-defined callback function that is used with the EM_SETAUTOCORRECTPROC message.

AutoCorrectProc is a placeholder for the application-defined function name. It provides application-defined automatic error correction for text entered into a rich edit control.

Syntax

AutoCorrectProc Autocorrectproc;

int Autocorrectproc(
  LANGID langid,
  const WCHAR *pszBefore,
  WCHAR *pszAfter,
  LONG cchAfter,
  LONG *pcchReplaced
)
{...}

Parameters

langid

Type: LANGID

Language ID that identifies the autocorrect file to use for automatic correcting.

pszBefore

Type: const WCHAR*

Autocorrect candidate string.

pszAfter

Type: WCHAR*

Resulting autocorrect string, if the return value is not ATP_NOCHANGE.

cchAfter

Type: LONG

Count of characters in pszAfter.

pcchReplaced

Type: LONG*

Count of trailing characters in pszBefore to replace with pszAfter.

Return value

Type: int

Returns one or more of the following values.

Return code/value Description
ATP_NOCHANGE
0
No change.
ATP_CHANGE
1
Change but don’t replace most delimiters, and don’t replace a span of unchanged trailing characters (preserves their formatting).
ATP_NODELIMITER
2
Change but don’t replace a span of unchanged trailing characters.
ATP_REPLACEALLTEXT
4
Replace trailing characters even if they are not changed (uses the same formatting for the entire replacement string).

Requirements

Requirement Value
Minimum supported client Windows 8 [desktop apps only]
Minimum supported server Windows Server 2012 [desktop apps only]
Target Platform Windows
Header richedit.h

See also

EM_CALLAUTOCORRECTPROC

EM_GETAUTOCORRECTPROC

EM_SETAUTOCORRECTPROC