Compartilhar via


IMultiLanguage2::ConvertString method

Converts the given source string from the source code page to the destination code page.

Syntax

HRESULT ConvertString(
  [in, out] DWORD *pdwMode,
  [in]      DWORD dwSrcEncoding,
  [in]      DWORD dwDstEncoding,
  [in]      BYTE  *pSrcStr,
  [in, out] UINT  *pcSrcSize,
  [in]      BYTE  *pDstStr,
  [in, out] UINT  *pcDstSize
);

Parameters

  • pdwMode [in, out]
    The address of storage for conversion context. The calling function should only provide storage that is initialized with zero at the first call to the method. The caller should not modify this value.

  • dwSrcEncoding [in]
    The code page identifier value for the source string. This value is equivalent to the uiCodePage member of the MIMECPINFO structure assigned to dwSrcEncoding.

  • dwDstEncoding [in]
    The code page identifier value for the destination string. This value is equivalent to the uiCodePage member of the MIMECPINFO structure assigned to dwDstEncoding.

  • pSrcStr [in]
    The address of the string to be converted.

  • pcSrcSize [in, out]
    The ddress of the buffer that stores the length of the source string, in bytes. If this is NULL, or if the length specified is -1, the API assumes pSrcStr is null-terminated. When conversion is successful, the method returns the number of bytes processed to this buffer.

  • pDstStr [in]
    The address of the string buffer where the conversion result is stored.

  • pcDstSize [in, out]
    The address of the buffer that stores the length of pDstStr, in bytes. When conversion is successful, the method returns the number of bytes copied to pDstStr to this buffer.

Return value

Returns one of the following values.

Return code Description
S_OK

Success.

S_FALSE

The specified conversion is not supported on the system.

E_FAIL

An error occurred.

 

Remarks

Note that this method takes a pointer to a BYTE array for both the source string buffer and the destination string buffer. The size of this buffer is handled as the number of bytes for the inbound parameter and the outbound parameter.

Requirements

Minimum supported client

Windows XP

Minimum supported server

Windows 2000 Server

Header

Mlang.h

IDL

Mlang.idl

DLL

Mlang.dll

See also

IMultiLanguage2