From: Bob Moore on 12 Mar 2008 06:49 On Tue, 11 Mar 2008 09:25:36 -0500, Joseph M. Newcomer <newcomer(a)flounder.com> wrote: >For example, make sure all >uses of 'char' are replaced by 'TCHAR', all uses of 'char *' by 'LPTSTR' and all uses of >'const char *' by LPCTSTR. Make sure all "..." and '.' literals have _T() around them. I've just been through this process on several projects, and that's a pretty comprehensive description. When I described it to our management team I expected that the largest part of the process would be catching all those places where there were implicit assumptions about 1 character == 1 byte, and that did indeed turn out to be the case. There are an awful lot of instances of * sizeof(TCHAR) and / sizeof(TCHAR) in our code now. What did annoy me a little though was the fact that deciding when a "count" parameter refers to bytes or characters can be tricky, and I encountered several cases where the Windows docs were ambiguous in this respect. Sadly, I didn't keep a copy of those cases for future reference. Colour me stupid. Bob Moore http://bobmoore.mvps.org/
From: Tom Serface on 12 Mar 2008 11:46 I think if anyone is serious about using Unicode with MFC they should upgrade to a more recent version. There is much better Unicode functionality and integration now than before. The debugger works better with Unicode, and you can even convert your .RC files to Unicode and the IDE will use them. That makes language translations much easier. Tom "Giovanni Dicanio" <giovanni.dicanio(a)invalid.com> wrote in message news:espaHnChIHA.5368(a)TK2MSFTNGP04.phx.gbl... > If the OP is using VC6 (like I read in the first post), I think he must > use the #defines. > > This Mihai's blog entry can help: > > Visual Studio Unicode projects > http://www.mihai-nita.net/article.php?artID=20060723a > > Giovanni > >
From: Joseph M. Newcomer on 12 Mar 2008 12:15 Usually, the documentation is very clear on when it means "characters" and "bytes". One of the few places this could be confusing is in the Register API, which very much says "bytes", and does leave it up to the programmer to realize that a REG_SZ read into a Unicode app really does require "bytes" as the API states. I had gone through a lot of the API years ago when I was writing Win32 Programming, and found only one error in the whole of the API I had looked at, but if you remember any of the cases, I'd love to hear about them; I'll add them to my "Errors and Omissions" document. joe On Wed, 12 Mar 2008 10:49:12 +0000, Bob Moore <> wrote: >On Tue, 11 Mar 2008 09:25:36 -0500, Joseph M. Newcomer ><newcomer(a)flounder.com> wrote: > >>For example, make sure all >>uses of 'char' are replaced by 'TCHAR', all uses of 'char *' by 'LPTSTR' and all uses of >>'const char *' by LPCTSTR. Make sure all "..." and '.' literals have _T() around them. > >I've just been through this process on several projects, and that's a >pretty comprehensive description. > >When I described it to our management team I expected that the largest >part of the process would be catching all those places where there >were implicit assumptions about 1 character == 1 byte, and that did >indeed turn out to be the case. There are an awful lot of instances of > >* sizeof(TCHAR) and >/ sizeof(TCHAR) > >in our code now. > >What did annoy me a little though was the fact that deciding when a >"count" parameter refers to bytes or characters can be tricky, and I >encountered several cases where the Windows docs were ambiguous in >this respect. Sadly, I didn't keep a copy of those cases for future >reference. Colour me stupid. > >Bob Moore >http://bobmoore.mvps.org/ Joseph M. Newcomer [MVP] email: newcomer(a)flounder.com Web: http://www.flounder.com MVP Tips: http://www.flounder.com/mvp_tips.htm
From: Joseph M. Newcomer on 12 Mar 2008 12:17 I was doing it years ago in VS6, and it isn't any more difficult. I can convert about 60K lines in a day or so of editing and a few hours of debugging. joe On Tue, 11 Mar 2008 14:48:19 -0000, "David Webber" <dave(a)musical-dot-demon-dot-co.uk> wrote: > >"Rami" <rami(a)giron.com> wrote in message >news:uFWvSn3gIHA.6032(a)TK2MSFTNGP03.phx.gbl... > >>I have a project in VC 6.0 which composed of a one main and several dll's. >> I want to convert all the projects gradually to UNICODE. However, since >> its >> a gradual process, through the debugging and integration, I may need to >> work >> with ASCII as well. >> Is it possible to do so? >> Is there some constrain on the interface in this case(or some other)? > >I'll back up what Ajay and Joe said. I converted a large project >gradually, but the gradual bit was replacing all the char's by TCHAR's (in a >project with multiple DLLs) and of course all the other stuff which has to >be consistent with that, over a period of about a year. > >When I thought I had finished, I defined UNICODE and _UNICODE in the >projects, and it became Unicode. Of course I had missed a few things but >it only took a few hours of bug hunting. > >But I did it in VS2005 - it may be harder in VC6.0. > >Dave Joseph M. Newcomer [MVP] email: newcomer(a)flounder.com Web: http://www.flounder.com MVP Tips: http://www.flounder.com/mvp_tips.htm
From: Ajay Kalra on 12 Mar 2008 12:22
On Mar 11, 11:25 pm, "David Ching" <d...(a)remove-this.dcsoft.com> wrote: > "Ajay Kalra" <ajayka...(a)yahoo.com> wrote in message > > news:BC1E2EE3-FEE0-4CAC-B094-AFC401AE5179(a)microsoft.com... > > > > > "Bob Moore" wrote in message > >news:jh5et3ped2q5mmuu8c8je4f7t3587ui7mv(a)4ax.com... > >> On Tue, 11 Mar 2008 14:45:46 -0400, Ajay Kalra wrote: > > >>>I think you need both, UNICODE and _UNICODE. > > >> Yes, one is for the Windows api, the other for the C runtime, > > > Thats how I recall it. > > There is an IDE setting in the General project page that you can set this in > a combobox. No need to type any of these #defines anymore. > > -- David OK. I have been out of touch with this for a while. Nothing like this in C#. --- Ajay |