IMLangLineBreakConsole In...     IMLangLineBreakConsole::B...     IMLangLineBreakConsole In...    
Web Workshop (Miscellaneous)

IMLangLineBreakConsole::BreakLineA 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] 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] Address of the number of bytes that can be fit in the given line before a line break should be inserted.
pcchSkip
[out] Address of the number of bytes in the source string to skip after the line break.

Return Value

Returns one of the following values:

S_OK Success.
E_FAIL An unexpected error occurred.
E_OUTOFMEMORY There is insufficient memory available to complete the requested operation.

Remarks

IMLangLineBreakConsole::BreakLineW is the Unicode version of BreakLineA.

The cchSrc parameter must always be specified, even if pszSrc 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.

Windows CE

Windows CE Use version 2.12 and later
Minimum availability Internet Explorer 4.0

Example

The following code fragment takes the string pszSrc and breaks it into multiple lines based on locale, codepage, and cMaxColumns.

int cchSrc = lstrlen(pszSrc);
int cchDone = 0;

while (cchDone < cchSrc)
{
    int cchLine;
    int cchSkip;

    pMLangLineBreak->BreakLineA(locale, codepage,
        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;
}


Back to topBack to top

Did you find this topic useful? Suggestions for other topics? Write us!

© 1999 Microsoft Corporation. All rights reserved. Terms of use.