Re: CString + unicode
I found that putting as many strings as possible in the string table (rather
than hard coding) helps a lot as well. When your project gets to the point
where you want to go international you'll be glad to have the strings in the
string table. I wrote this small routine (could have been a macro) to
insert a "string" anywhere I I want:
//
// Converts a string resource into a CString. Useful when a string is needed
in a function
//
CString GRS(UINT nID)
{
CString cs;
cs.LoadString(nID);
return cs;
}
Using this I can do something like:
pWnd->SetWindowText(GRS(IDS_SOMEMSG));
Lots of functions can take either the CString or an ID (AfxMessageBox,
CString::Format, etc.), but this is useful for the times where that doesn't
work and helps me with resources.
Tom
"Mihai N." <nmihai_year_2000@yahoo.com> wrote in message
news:Xns982216881FC06MihaiN@207.46.248.16...
but it was too much like hard work, so I have tried hard to catch them
all
and make them LPCSTR LPCTSTR LPCWSTR etc. But, as you say, it easy to
miss
one!
A good trick is to add Unicode configurations to the project.
You probably have Release and Debug, add ReleaseU and DebugU and make them
Unicode.
Then you can try to compile and fix stuff, while still being able to build
the original ANSI version.
With a bit of work you will be able to build both versions from the same
code
and the same project.
Even if you have no rush to release the Unicode version, this way you can
take advantage if you get some free time and fix the unicode part, a bit
today, a bit next week.
--
Mihai Nita [Microsoft MVP, Windows - SDK]
http://www.mihai-nita.net
------------------------------------------
Replace _year_ with _ to get the real email