Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
MSDN Library


Windows Mobile 6.5
A version of this page is also available for

This method detects the code page of the given string.

HRESULT DetectInputCodepage( 
  DWORD dwFlag,
  DWORD dwPrefWinCodePage,
  CHAR* pSrcStr,
  INT* pcSrcSize,
  DetectEncodingInfo* lpEncoding,
  INT* pnScores


[in] Specifies one of the MLDETECTCP-defined bit flag values that specify the type of incoming source text. Setting the bit flags helps the detection engines produce more accurate results.


[in] Specifies the preferred Windows code page. If this value is set to zero, this method returns all possible encodings. Otherwise, it lists only those encodings related to this parameter.


[in] Source string for which the client wants to detect the code page.


[in, out] Address of the buffer that stores the size of the string pointed to by the pSrcStr parameter, in bytes. When this method is successful, it returns the number of bytes processed to this buffer.


[in, out] Pointer to an array of DetectEncodingInfo structures where the detection information will be returned.


[in, out] Pointer to a buffer that contains the number of DetectEncodingInfo structures allocated in the array pointed to by the lpEncoding parameter. When this method is successful, this parameter returns the number of elements of the array that have been filled in.

The following table shows the possible return values for this method.

Value Description




The method cannot determine the code page of the input stream.


An error occurred.

The caller is responsible for allocating and freeing the lpEncoding array.

Headermlang.h, mlang.idl
Windows Embedded CEWindows CE .NET 4.0 and later
Windows MobileWindows Mobile Version 5.0 and later

Community Additions

© 2015 Microsoft