Revision: 8505 https://osdn.net/projects/ttssh2/scm/svn/commits/8505 Author: zmatsuo Date: 2020-01-27 00:13:45 +0900 (Mon, 27 Jan 2020) Log Message: ----------- 9xでは Unicode API を使用しない - CreateWindowExW(), RegisterClassW() を使用しない(compat_win.cpp) - DrawTextW() を使用しない(layer_for_unicode.cpp) - ANSI API を使用するようにした Modified Paths: -------------- trunk/teraterm/common/compat_win.cpp trunk/teraterm/common/layer_for_unicode.cpp -------------- next part -------------- Modified: trunk/teraterm/common/compat_win.cpp =================================================================== --- trunk/teraterm/common/compat_win.cpp 2020-01-26 15:13:39 UTC (rev 8504) +++ trunk/teraterm/common/compat_win.cpp 2020-01-26 15:13:45 UTC (rev 8505) @@ -212,6 +212,8 @@ pSetDlgItemTextW = NULL; pGetDlgItemTextW = NULL; pDialogBoxIndirectParamW = NULL; + pCreateWindowExW = NULL; + pRegisterClassW = NULL; } // GetConsoleWindow\x93\xC1\x95ʏ\x88\x97\x9D Modified: trunk/teraterm/common/layer_for_unicode.cpp =================================================================== --- trunk/teraterm/common/layer_for_unicode.cpp 2020-01-26 15:13:39 UTC (rev 8504) +++ trunk/teraterm/common/layer_for_unicode.cpp 2020-01-26 15:13:45 UTC (rev 8505) @@ -232,7 +232,13 @@ } /** - * TODO:9x\x8Cn\x82\xC5DrawTextW\x82\xAA\x8Eg\x82\xA6\x82\xE9? + * @param[in] hdc + * @param[in] lpchText \x95\xB6\x8E\x9A\x97\xF1 + * @param[in] cchText \x95\xB6\x8E\x9A\x90\x94(-1\x82̂Ƃ\xABlpchText\x82̕\xB6\x8E\x9A\x97\xF1\x92\xB7) + * @param[in] lprc \x95\\x8E\xA6rect + * @param[in] format + * + * TODO:9x\x8Cn\x82\xC5DrawTextW\x82\xAA\x90\xB3\x82\xB5\x82\xAD\x93\xAE\x8D삷\x82\xE9? */ int _DrawTextW(HDC hdc, LPCWSTR lpchText, int cchText, LPRECT lprc, UINT format) { @@ -240,9 +246,10 @@ return DrawTextW(hdc, lpchText, cchText, lprc, format); } - char *strA = ToCharW(lpchText); - int strA_len = (int)strlen(strA); - int result = DrawTextA(hdc, strA, strA_len, lprc, format); + int strW_len = (cchText == -1) ? 0 : cchText; + size_t strA_len; + char *strA = _WideCharToMultiByte(lpchText, strW_len, CP_ACP, &strA_len); + int result = DrawTextA(hdc, strA, (int)strA_len, lprc, format); free(strA); return result; }