IMLangLineBreakConsole::BreakLineW

This method determines where to break the given string based on the specified maximum number of columns.

HRESULT BreakLineW( 
  LCID locale,
  const WCHAR* pszSrc,
  long cchSrc,
  long cMaxColumns,
  long* pcchLine,
  long* pcchSkip
);

Parameters

  • locale
    [in] Locale identifier for the source string.
  • pszSrc
    [in] Pointer to the source Unicode string.
  • cchSrc
    [in] Number of Unicode characters in the source string.
  • cMaxColumns
    [in] Maximum number of columns that can be output per line.
  • pcchLine
    [out] Pointer to an integer containing the number of Unicode characters that can fit in the given line before a line break should be inserted.
  • pcchSkip
    [out] Pointer to an integer containing the number of characters in the source string to skip after the line break.

Return Values

The following table shows the possible return values for this method.

Value Description
S_OK Success.
E_FAIL An error occurred.
E_OUTOFMEMORY There is not enough memory to complete the operation.

Remarks

This method is the Unicode version of the IMLangLineBreakConsole::BreakLineA method.

The cchSrc parameter must always be specified, even if the string pointed to by the pszSrc parameter is a null-terminated string.

The number of columns is the same as the number of half-width characters. One full-width character is two columns wide.

The pcchSkip parameter retrieves the number of characters that do not need to be displayed at the start of the next line. For example, if the string "Hello world!" is broken after "Hello", pcchSkip will be set to 1, indicating that the space between the words should not be output to the next line.

Example Code

The following example shows the syntax that breaks the string pointed to by the pszSrc parameter into multiple lines based on the locale and value of the cMaxColumns parameter.

int cchSrc = wcslen(pwszSrc);
int cchDone = 0;
while (cchDone < cchSrc)
{
    int cchLine;
    int cchSkip;
    pMLangLineBreak->BreakLineW(locale, pwszSrc + cchDone,
        cchSrc - cchDone, cMaxColumns, &cchLine, &cchSkip);
    // The characters between (pwszSrc + cchDone) and
    // (pwszSrc + cchDone + cchLine - 1) should be
    // output as one line.
    cchDone += cchLine + cchSkip;
}

Requirements

OS Versions: Windows CE .NET 4.0 and later.
Header: Mlang.h, Mlang.idl.
Link Library: Mlang.dll.

 Last updated on Thursday, April 08, 2004

© 1992-2003 Microsoft Corporation. All rights reserved.