Postby freesunshine » 19 Mar 2012 06:01
this is my origin code:
AXVLC::IVLCPlaylistPtr plo(reinterpret_cast<AXVLC::IVLCPlaylist*>(mVLC.get_playlist()), false);
CString file("file:///c:\你好.avi");
plo->add(file.GetString());
plo->play();
and it can't work;
someone told me that vlc only accept utf-8 strings,so i wrote this:
CStringA str(file);
USES_CONVERSION;
wchar_t* wszString = T2W(file.GetBuffer());
int u8Len = ::WideCharToMultiByte(CP_UTF8, NULL, wszString, wcslen(wszString), NULL, 0, NULL, NULL);
char* szU8 = new char[u8Len + 1];
::WideCharToMultiByte(CP_UTF8, NULL, wszString, wcslen(wszString), szU8, u8Len, NULL, NULL);
szU8[u8Len] = '\0';
AXVLC::IVLCPlaylistPtr plo(reinterpret_cast<AXVLC::IVLCPlaylist*>(mVLC.get_playlist()), false);
plo->add(szU8);
plo->play();
but still failed