EDITWORDBREAKPROCW callback function (winuser.h)
An application-defined callback function used with the EM_SETWORDBREAKPROC message. A multiline edit control or a rich edit control calls an EditWordBreakProc function to break a line of text.
The EDITWORDBREAKPROC type defines a pointer to this callback function. EditWordBreakProc is a placeholder for the application-defined function name.
Syntax
EDITWORDBREAKPROCW Editwordbreakprocw;
int Editwordbreakprocw(
[in] LPWSTR lpch,
[in] int ichCurrent,
[in] int cch,
[in] int code
)
{...}
Parameters
[in] lpch
Type: LPTSTR
A pointer to the text of the edit control.
[in] ichCurrent
Type: int
An index to a character position in the buffer of text that identifies the point at which the function should begin checking for a word break.
[in] cch
Type: int
The number of TCHARs in the edit control text. For the ANSI text, this is the number of bytes; for the Unicode text, this is the number of WCHARs.
[in] code
Type: int
The action to be taken by the callback function. This parameter can be one of the following values.
Return value
Type: int
If the code parameter specifies WB_ISDELIMITER, the return value is nonzero (TRUE) if the character at the specified position is a delimiter, or zero if it is not. If the code parameter specifies WB_CLASSIFY, the return value is the character class and word break flags of the character at the specified position. Otherwise, the return value is an index to the beginning of a word in the buffer of text.
Remarks
A carriage return followed by a line feed must be treated as a single word by the callback function. Two carriage returns followed by a line feed also must be treated as a single word.
An application must install the callback function by specifying the address of the callback function in an EM_SETWORDBREAKPROC message.
Rich Edit 1.0:Microsoft Rich Edit 1.0 only passes back ANSI characters to EditWordBreakProc. For rich edit controls, you can alternately use the EM_SETWORDBREAKPROCEX message to replace the default extended word break procedure with an EditWordBreakProcEx callback function. This function provides additional information about the text, such as the character set.
Rich Edit 2.0 and later:Microsoft Rich Edit 2.0 and later only pass back Unicode characters to EditWordBreakProc. Thus, an ANSI application would convert the Rich Edit-supplied Unicode string using WideCharToMultiByte, and then translate the indices appropriately.
Note
The winuser.h header defines EDITWORDBREAKPROC as an alias that automatically selects the ANSI or Unicode version of this function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with code that is not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more information, see Conventions for Function Prototypes.
Requirements
Requirement | Value |
---|---|
Minimum supported client | Windows Vista [desktop apps only] |
Minimum supported server | Windows Server 2003 [desktop apps only] |
Target Platform | Windows |
Header | winuser.h (include Windows.h) |
See also
Other Resources
Reference