Suppose I have this:
LPTSTR MyString = _T("A string");
void SomeFunction(LPCWSTR param);
I can use one of the ATL conversion macros, CT2CW
, and the function works as expected:
SomeFunction(CT2CW(MyString));
However, if I have something like this:
LPWSTR WString = CT2CW(MyString); // or CT2W, it doesn't matter
Now WString
doesn't contain what I would expect it to; it just appears to contain garbage. I am sure this is some funky pointer business, but I am stumped.