fixed #347 fixed 'AddFontResource' path error!

This commit is contained in:
liswei 2011-08-08 10:32:21 +08:00
parent 976d886263
commit 70e19d7245
1 changed files with 9 additions and 4 deletions

View File

@ -85,6 +85,7 @@ public:
CC_BREAK_IF(! pwszBuffer); CC_BREAK_IF(! pwszBuffer);
memset(pwszBuffer,0,nBufLen); memset(pwszBuffer,0,nBufLen);
nLen = MultiByteToWideChar(CP_UTF8, 0, nString.c_str(), nLen, pwszBuffer, nBufLen); nLen = MultiByteToWideChar(CP_UTF8, 0, nString.c_str(), nLen, pwszBuffer, nBufLen);
pwszBuffer[nLen] = '\0';
} while (0); } while (0);
return pwszBuffer; return pwszBuffer;
@ -141,8 +142,10 @@ public:
wchar_t * pwszBuffer = utf8ToUtf16(m_curFontPath); wchar_t * pwszBuffer = utf8ToUtf16(m_curFontPath);
if (pwszBuffer) if (pwszBuffer)
{ {
RemoveFontResource(pwszBuffer); if(RemoveFontResource(pwszBuffer))
SendMessage( m_hWnd, WM_FONTCHANGE, 0, 0); {
SendMessage( m_hWnd, WM_FONTCHANGE, 0, 0);
}
delete [] pwszBuffer; delete [] pwszBuffer;
pwszBuffer = NULL; pwszBuffer = NULL;
} }
@ -154,8 +157,10 @@ public:
wchar_t * pwszBuffer = utf8ToUtf16(m_curFontPath); wchar_t * pwszBuffer = utf8ToUtf16(m_curFontPath);
if (pwszBuffer) if (pwszBuffer)
{ {
AddFontResource(pwszBuffer); if(AddFontResource(pwszBuffer))
SendMessage( m_hWnd, WM_FONTCHANGE, 0, 0); {
SendMessage( m_hWnd, WM_FONTCHANGE, 0, 0);
}
delete [] pwszBuffer; delete [] pwszBuffer;
pwszBuffer = NULL; pwszBuffer = NULL;
} }