From: Tony on
David,

Thanks a lot! I tried and it works!

I added a line "#undef UNICODE". Because I have tens of projects that
need to work with, can I add only change the project setting to have
the same result?

Best Regards,
Tony

From: David Wilkinson on
Tony wrote:

> David,
>
> Thanks a lot! I tried and it works!
>
> I added a line "#undef UNICODE". Because I have tens of projects that
> need to work with, can I add only change the project setting to have
> the same result?
>
> Best Regards,
> Tony
>

Tony:

I would think you need to "#undef _UNICODE" also. It is really better to
do this in the project settings. In VC7 (probably VC8 also) you can do
this on the Configuration Properties->General property page.

I think you will have to do this for every project. I doubt it is
possible to change default for entire VS2005 application (though it may
be, I really don't know).

David Wilkinson


From: Tom Widmer [VC++ MVP] on
Tony wrote:
> Thank you, Elias!
>
> My programs are all ANSI. To use LPCTSTR is because it looks better
> than const char* :-)

If it is meant to be a const char*, you can use LPCSTR (without the T).
This T stuff was just there to cope with the problem with the Win9x
series not using unicode natively, which is now something of a non
issue. Does anyone actually build applications for both Unicode and ANSI
now?

As far as I'm concerned, if I want unicode (e.g. for the UI) I use
wchar_t, if not I use char (e.g. for logging).

Tom
From: Heinz Ozwirk on
"Tony" <tony.yi.zhou(a)gmail.com> schrieb im Newsbeitrag news:1144828930.972567.238610(a)j33g2000cwa.googlegroups.com...
> Thank you, Elias!
>
> My programs are all ANSI. To use LPCTSTR is because it looks better
> than const char* :-)

How can something that is planly wrong look good? If your programs are ANSI and will never be unicode, use char const* (or const char*) or LPCSTR. LPCTSTR and LPTSTR are types that may be ansi or unicode, depending on the project's property settings.

> Should I define a macro to tell the compiler to work in ANSI mode?

No. Use the project's property settings and select Multi-Byte Characterset instead of Wide Characterset.

Heinz
From: Alex Blekhman on
Tom Widmer [VC++ MVP] wrote:
> [...] This T stuff was just there to cope with
> the problem with the Win9x series not using unicode
> natively, which is now something of a non issue. Does
> anyone actually build applications for both Unicode and
> ANSI now?

I think that most of vendors who actually would have
required to do both builds, figured out quite quickly that
they could get away with ANSI build only. Now we have tons
of [cripple] programs, which cannot manage Unicode input or
filenames. It can be especially infuriating when you're
using such program that should work with files a lot, like
DVD burning software, for example.