May I know how I can perform the following conversion?
// el.strCap is char[50]
// InsertItem is expecting TCHAR pointer (LPCTSTR)
// How I can perform conversion?
// I do not have access in both "list" and "el" source code
// Hence, there is no way for me to modify their signature.
list.InsertItem(i, el.strCap);
And No. I do not want to use
WideCharToMultiByte
They are too cumbersome to be used.
If you’re using ATL, then you can use the various macros and helper classes that it includes to do the conversion:
Though saying
WideCharToMultiByteis too cumbersome is a bit disingenious, in my opinion. It’s easy enough to wrap a call toWideCharToMultiByteand make it return an std::wstring or whatever you need. In fact, that’s basically whatCA2CTis doing under the covers…