2009-01-29, 04:57
Jester Wrote:that might work, i'll try it out in my next build as we are still working on improving the externalplayer bits....
I find the reason why trans the wrong string to external player. Because chinese windows use Unicode,and XBMC use UTF-8.
I modify the code like is:
Quote:void CExternalPlayer::ExecuteAppW32(const char* strPath, const char* strSwitches)
{
CLog::Log(LOGNOTICE, "%s: %s %s", __FUNCTION__, strPath, strSwitches);
STARTUPINFOW si;
PROCESS_INFORMATION pi;
memset(&si, 0, sizeof(si));
memset(&pi, 0, sizeof(pi));
si.cb = sizeof(si);
si.dwFlags = STARTF_USESHOWWINDOW;
int wcsLen = ::MultiByteToWideChar(CP_UTF8, NULL, strPath, strlen(strPath), NULL, 0);
wchar_t* WstrPath = new wchar_t[wcsLen + 1];
::MultiByteToWideChar(CP_UTF8, NULL, strPath, strlen(strPath), WstrPath, wcsLen);
WstrPath[wcsLen] = '\0';
wcsLen = ::MultiByteToWideChar(CP_UTF8, NULL, strSwitches, strlen(strSwitches), NULL, 0);
wchar_t* WstrSwitches = new wchar_t[wcsLen + 1];
::MultiByteToWideChar(CP_UTF8, NULL, strSwitches, strlen(strSwitches), WstrSwitches, wcsLen);
WstrSwitches[wcsLen] = '\0';
if (g_advancedSettings.m_externalPlayerHideconsole)
{
si.wShowWindow=SW_HIDE;
}
else
{
si.wShowWindow=SW_SHOW;
}
int ret = CreateProcessW(WstrPath, (LPWSTR) WstrSwitches, NULL, NULL, FALSE, NULL,
NULL, NULL, &si, &pi);
delete []WstrPath;
delete []WstrSwitches;
......
This work fine!!!!!