المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : MFC Conversion to Unicode in VS2008



C++ Programming
04-08-2009, 06:52 AM
Hi
I'm converting an existing C++ MFC project in VS2008 to Unicode. The project had previously been upgraded to VS2008 from VS2005 and is running successfully as MBCS built by VS2008. I have also successfully tested a small (new) MFC Unicode app in C++.

I set the Project Properties to "Use Unicode ..." instead of MBCS and did a rebuild. UNICODE and _UNICODE are defined in the Preprocessor directives due to 'Use Unicode ...' in the project properties. When I build I get a lot of errors related to the definition of szFaceName in CHARFORMAT2. The errors are related to the definition of CHARFORMAT szFaceName as 'char' rather than WCHAR. Looking at the definition of CHARFORMAT2 in Richedit.h it has:

#ifdef UNICODE
#define CHARFORMAT2 CHARFORMAT2W
#else
#define CHARFORMAT2 CHARFORMAT2A
#endif

and the CHARFORMAT2A line is the one highlighted - effectively saying that UNICODE is NOT defined.

I am at a loss to understand why UNICODE is undefined in Richedit.h and how to fix it. I have tried defining UNICODE and _UNICODE in stdafx.h without any success.

I'd be grateful for any help with this - its driving me crackers.

Thanks in anticipation http://www.barakasoft.com/script/Forums/Images/smiley_smile.gif