TranslateCharsetInfo failing

  • Thread starter Thread starter PLS
  • Start date Start date
P

PLS

I hope someone can explain why this piece of code is failing:

CHARSETINFO csi;
BOOL brc = TranslateCharsetInfo(&cf.locale, &csi, TCI_SRCLOCALE);

cf.locale is an LCID with value 0x00000409.
The function returns false and GetLastError returns 0x57, invalid
parameter. The operating system is US Windows XP SP2.

What is the problem?

The use here is that I have a locale code and need the charset for a
LOGFONT structure and the code page.

Thanks,
++PLS
 
Hello,
CHARSETINFO csi;
BOOL brc = TranslateCharsetInfo(&cf.locale, &csi, TCI_SRCLOCALE);

Citetion from MSDN Lib:

pSrc:
Pointer to the fsCsb member of a FONTSIGNATURE structure if dwFlags is set to
TCI_SRCFONTSIG. Otherwise, this parameter is set to a DWORD value indicating the
source.

So you should use:

BOOL brc = TranslateCharsetInfo((DWORD *)cf.locale, &csi, TCI_SRCLOCALE);

-- best regards

Cezary Noweta
 
Back
Top