The find word hook allows an application to control where WinDrawText breaks a character string that is too wide for the drawing rectangle. If the DT_WORDBREAK flag is set, the system calls this hook from within WinDrawText. Typically, this hook is used to avoid awkward line breaks in applications that use double-byte character sets. The following code shows the syntax for a find word hook function:
BOOL EXPENTRY FindWordHook(USHORT usCodepage, PSZ pszText, ULONG cb, ULONG ich, PULONG pichStart, PULONG pichEnd, PULONG pichNext);
The usCodePage parameter contains the code page identifier of the string to be formatted; the pszText parameter contains a pointer to the actual string.
The cb parameter contains a value specifying the number of bytes in the string. This value is 0 if the string is null-terminated.
The ich parameter contains the index of the character in the string that intersects the right edge of the drawing rectangle.
A find word hook function uses these four parameters to determine the word that contains the intersecting character. It then fills the remaining three parameters, pichStart, pichEnd, and pichNext, with the indexes of the starting character of the word, ending character of the word, and starting character of the next word in the string.
If the find word hook function returns TRUE, WinDrawText draws the string only up to, but not including, the specified word. If the function returns FALSE, WinDrawText formats the string in the default manner.