다음을 통해 공유


IMLangLineBreakConsole::BreakLineA (Windows CE 5.0)

Send Feedback

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

HRESULTBreakLineA(LCIDlocale,UINTuCodePage,constCHAR* pszSrc,longcchSrc,longcMaxColumns,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 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

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

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

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.