Re: Is there any problems if there are multiple MFC dlls in one pr
"Tom Lee" <Tom.Lee@community.nospam> ha scritto nel messaggio
news:F10AEAD5-4EBB-432D-9AD9-E17380AE084D@microsoft.com...
It's a good idea to change the ANSI header file:)
To add to what Joe correctly wrote, I would suggest - to better support
Unicode-aware coding (i.e. LPCTSTR) to "decorate" function names with
something like a suffix to differentiate between ANSI and Unicode, e.g.
void DoSomethingA( const char * s ); // ANSI version
void DoSomethingW( const wchar_t * s ); // Unicode version
One can first implement the Unicode version (W), then the ANSI version can
be just a little "wrapper" to the Unicode version, with proper text
conversion, i.e.
void DoSomethingA( const char * s )
{
1. convert string from ANSI to Unicode (using e.g. CA2W)
2. Call DoSomethingW with converted string
}
then, in the header file, you can have something like this:
#ifdef UNICODE
#define DoSomething DoSomethingW
#else
#define DoSomething DoSomethingA
#endif // UNICODE
So, in this way, a working 'void DoSomething( LPCTSTR s )' is "simulated".
This is also the way that some Windows Win32 SDK headers follow, to offer
the Unicode aware LP[C]TSTR feature, with C linkage.
Note that, for converting strings e.g. from ANSI to Unicode, I would suggest
to use the more robust C<X>2<Y> (e.g. CA2W) helper classes, available since
Visual C++ 7.x, and not use <X>2<Y> (e.g. A2W) available in VC6.
Giovanni