Convert ansi string to unicode string?
Posted on 2005-03-05
I have a win32 console app. All I need to do is convert a command line argument to a unicode string, but it seems to always fail.
int main(int argc, _TCHAR* argv)
// Copy argv into a unicode string.
MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, argv, (int)strlen(argv), wcMyUnicodeString, MAX_PATH);
// This prints out just fine.
// Now I want to pass it to this interface:
but it always fails at SetApplicationName()!!!!! It works just fine if I use a unicode literal such as:
SetApplicationName() takes a LPCWSTR as its only parameter, is this not compatible with my w_chart? I thought it would be the same as the literal string I preceded with the capital L?
Please help me.