Just downloaded VC++ 8.0 Express and tried to run a simple sdk style program to see what happens. I've been using Dev C++, CodeBlocks, and MS VC++ 6. I've been advised to get up to date. Anyway, to get the program to run I had to change all the Api calls with string parameters to 'A' versions. If my memory serves me correct with my other compilers there were #defines of UNICODE and/or _UNICODE that controlled whether 'A' or 'W' versions of the declares were compiled. When I saw what was happening I tried to #undef UNICODE and _UNICODE, but that didn't result in any positive outcome.

The other issue I had was with the .lpfnWndProc member of WNDCLASSEX. It appears WNDPROC must be redefined somewheres because intellisence was telling me it wanted a LPCWSTR instead of LPCTSTR or whatever it was before (believe that's right, and would reduce to LPCSTR if UNICODE wasn't defined). So to get that to work I had to put a 'L' in front of the string name of the window procedure.

Is there a way to just get it to default to the 'A' versions of things? I do a lot of Windows CE programming and there I've had to more or less make peace with the way things are so I use wchar_t instead of char and preface all my literals with 'L' as that seems like the easiest and cleanest alternative and spares me from those aweful TEXT and _T macros I really don't like very much. But up 'till now what little Windows desktop programming I do with C/C++ I've been spared the whole UNICODE thing. Looks like that's over with. Or is it possible to modify the VC++ environment to use ansi strings without having to postpend 'A' to everything?

For VC++ 9 (2008):
Create/open the project then menu: Project|Properties then select Configuration Properties|General and set Character Set to Not Set.
I don't know how to do that in VC++ 8 (2005) but I suspect the same procedure...

Thanks ArkM. I'll give that a try. I had snooped around in there looking for something relating to unicode settings, but as you know, its considerably different from my old VC 6 (actually, now that I've seen it, I know where the CodeBlocks look came from......).

In VC++ 2008 UNICODE is turned on by default :( . AFAIK there is no way to change this default behavior when creating a project. I always have to turn it off as ArkM posted.

Or just get used to using TEXT() macros all over the place, and stop worrying about what each revision of the IDE defaults to for character encoding.

UNICODE isn't going away any time soon, so you're going to have to learn to deal with it.

Or just get used to using TEXT() macros all over the place, and stop worrying about what each revision of the IDE defaults to for character encoding.

UNICODE isn't going away any time soon, so you're going to have to learn to deal with it.

Yes, you're right Salem! But its hard! Last year I spent about six months working on a large Win CE program, and at some point I would like to be able to get that working on the Windows desktop. I'd have been a lot further ahead probably had I just caved in to the whole text macro thing (TEXT(""), and so forth), but, the stuff very much affronts my long developed coding style sensibilities.

C++ probably had no alternative in the matter, being as its the type of language it is. So acceptance is the only alternative if one is going to use C++. Other language products of course have other alternatives. Thanks again all for the feedback.

This article has been dead for over six months. Start a new discussion instead.