You can't simply cast between WCHAR and char *. It won't work. Including that you can't cast FindFileData.cFileName; nor can you cast mp3fi.szArtist.
On the other hand, I do have some functions you could use to accomplish this goal. You should be able to use codepage = CP_ACP (the default system codepage), flags = 0.
Code:
std::basic_string<WCHAR> ToWideChar(std::basic_string<CHAR> s, UINT codepage, DWORD flags){
// Get the needed size
int neededSize = MultiByteToWideChar(
codepage,
flags,
s.c_str(),
(int) s.size(),
NULL,
0);
if (neededSize == 0) throw std::runtime_error("Unable to determine the size of buffer needed");
WCHAR * buffer = new WCHAR[neededSize];
int size = MultiByteToWideChar(
codepage,
flags,
s.c_str(),
(int) s.size(),
buffer,
neededSize);
std::basic_string<WCHAR> ret(buffer,size);
delete[] buffer;
return ret;
}
std::basic_string<CHAR> ToMultibyte(std::basic_string<WCHAR> s, UINT codepage, DWORD flags){
// Get the needed size
int neededSize = WideCharToMultiByte(
codepage,
flags,
s.c_str(),
(int) s.size(),
NULL,
0,
NULL,
NULL);
if (neededSize == 0) throw std::runtime_error("Unable to determine the size of buffer needed");
CHAR * buffer = new CHAR[neededSize];
int size = WideCharToMultiByte(
codepage,
flags,
s.c_str(),
(int) s.size(),
buffer,
neededSize,
NULL,
NULL);
std::basic_string<CHAR> ret(buffer,size);
delete[] buffer;
return ret;
}
You'd use them like this:
Code:
mp3fi.Init( ToMultibyte(FindFileData.cFileName,CP_ACP,0).c_str() );
std::basic_string<WCHAR> artist = ToWideChar(mp3fi.szArtist, CP_ACP,0);
MessageBox(NULL, artist.c_str(), L"!", MB_ICONINFORMATION);