Share via


IMLangLineBreakConsole::BreakLineA

A version of this page is also available for

Windows Embedded CE 6.0 R3

4/8/2010

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

Syntax

HRESULT BreakLineA( 
  LCID locale,
  UINT uCodePage,
  const CHAR* pszSrc,
  long cchSrc,
  long cMaxColumns,
  long* pcchLine,
  long* pcchSkip
);

Parameters

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

Return Value

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

The IMLangLineBreakConsole::BreakLineW method is the Unicode version of this method.

The cchSrc parameter must always be specified, even if the source 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 takes the string pointed to by the pszSrc parameter and breaks it into multiple lines based on locale, the value of the uCodePage parameter, and the value of the cMaxColumns parameter.

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

Requirements

Header mlang.h, mlang.idl
Library mlang.dll
Windows Embedded CE Windows CE .NET 4.0 and later
Windows Mobile Windows Mobile Version 5.0 and later