Compartilhar via


IMLangConvertCharset::DoConversionFromUnicode method

Converts the given wide-character string from Unicode to the destination code page of the Conversion object.

Syntax

HRESULT DoConversionFromUnicode(
  [in]      WCHAR     *pSrcStr,
  [in, out] UINT      *pcSrcSize,
  [in]      __wchar_t *pDstStr,
  [in, out] UINT      *pcDstSize
);

Parameters

  • pSrcStr [in]
    A pointer to the Unicode string to be converted.

  • pcSrcSize [in, out]
    A pointer to an unsigned integer that stores the length of the source string, in character counts. If this is NULL, or if the length specified is -1, the method assumes pSrcStr is null-terminated.

  • pDstStr [in]
    A pointer to the string where the conversion result is stored.

  • pcDstSize [in, out]
    A pointer to an unsigned integer that stores the length, in bytes, of the buffer specified with pDstStr. When conversion is successful, the method returns the number of bytes copied to pDstStr.

Return value

Returns one of the following values.

Return code Description
S_OK

Success.

S_FALSE

The conversion specified is not supported. This happens when the newly detected source code page is not supported on the system.

E_FAIL

An error occurred.

 

Remarks

Unlike IMLangConvertCharset::DoConversion, this method always converts from Unicode to a multibyte code page.

To use this method correctly, the source code page of the Conversion object must be initialized to Unicode. If the source code page is not Unicode, the method performs the conversion, but the result is not guaranteed.

Note that the size of the Unicode string to be converted is given in characters, while the size of the returned multibyte string is given in bytes.

Requirements

Minimum supported client

Windows XP

Minimum supported server

Windows 2000 Server

Header

Mlang.h

IDL

Mlang.idl

DLL

Mlang.dll

See also

IMLangConvertCharset

Reference

DoConversionToUnicode

Initialize