Converts the given source string from the source code page to the destination code page.
Syntax
HRESULT ConvertString( DWORD *pdwMode, DWORD dwSrcEncoding, DWORD dwDstEncoding, BYTE *pSrcStr, UINT *pcSrcSize, BYTE *pDstStr, UINT *pcDstSize );
Parameters
- pdwMode
- [in, out] 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] 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] 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] Address of the string that is being converted.
- pcSrcSize
- [in, out] Address 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] Address of the string buffer where the conversion result is stored.
- pcDstSize
- [in, out] 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:
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 and destination string buffers. The size of this buffer is handled as the number of bytes for both the inbound and outbound parameters.