Revision: 8590 https://osdn.net/projects/ttssh2/scm/svn/commits/8590 Author: zmatsuo Date: 2020-03-12 22:51:56 +0900 (Thu, 12 Mar 2020) Log Message: ----------- About TTSSH で Hash Type を切り替えたときの文字化けを修正 - _SetWindowLongPtrW() を layer_for_unicode に追加 - SetWindowLongPtrA() でプロシージャの設定を行うと、ANSI Window 扱いになるようだ Modified Paths: -------------- trunk/teraterm/common/compat_win.cpp trunk/teraterm/common/compat_win.h trunk/teraterm/common/layer_for_unicode.cpp trunk/teraterm/common/layer_for_unicode.h trunk/ttssh2/ttxssh/ttxssh.c -------------- next part -------------- Modified: trunk/teraterm/common/compat_win.cpp =================================================================== --- trunk/teraterm/common/compat_win.cpp 2020-03-12 01:35:06 UTC (rev 8589) +++ trunk/teraterm/common/compat_win.cpp 2020-03-12 13:51:56 UTC (rev 8590) @@ -67,6 +67,7 @@ HWND (WINAPI *pCreateDialogIndirectParamW)(HINSTANCE hInstance, LPCDLGTEMPLATEW lpTemplate, HWND hWndParent, DLGPROC lpDialogFunc, LPARAM dwInitParam); +LONG_PTR (WINAPI *pSetWindowLongPtrW)(HWND hWnd, int nIndex, LONG_PTR dwNewLong); // gdi32.lib int (WINAPI *pAddFontResourceExW)(LPCWSTR name, DWORD fl, PVOID res); @@ -159,6 +160,7 @@ { "SendMessageW", (void **)&pSendMessageW }, { "GetWindowTextW", (void **)&pGetWindowTextW }, { "GetWindowTextLengthW", (void **)&pGetWindowTextLengthW }, + { "SetWindowLongPtrW", (void **)&pSetWindowLongPtrW }, #endif { "EnumDisplayMonitors", (void **)&pEnumDisplayMonitors }, { "MonitorFromWindow", (void **)&pMonitorFromWindow }, Modified: trunk/teraterm/common/compat_win.h =================================================================== --- trunk/teraterm/common/compat_win.h 2020-03-12 01:35:06 UTC (rev 8589) +++ trunk/teraterm/common/compat_win.h 2020-03-12 13:51:56 UTC (rev 8590) @@ -114,6 +114,7 @@ extern int (WINAPI *pGetWindowTextW)(HWND hWnd, LPWSTR lpString, int nMaxCount); extern int (WINAPI *pGetWindowTextLengthW)(HWND hWnd); extern BOOL (WINAPI *pShell_NotifyIconW)(DWORD dwMessage, NOTIFYICONDATAW *lpData); +extern LONG_PTR (WINAPI *pSetWindowLongPtrW)(HWND hWnd, int nIndex, LONG_PTR dwNewLong); void WinCompatInit(); Modified: trunk/teraterm/common/layer_for_unicode.cpp =================================================================== --- trunk/teraterm/common/layer_for_unicode.cpp 2020-03-12 01:35:06 UTC (rev 8589) +++ trunk/teraterm/common/layer_for_unicode.cpp 2020-03-12 13:51:56 UTC (rev 8590) @@ -517,3 +517,12 @@ } return DialogBoxIndirectParamA(hInstance, hDialogTemplate, hWndParent, lpDialogFunc, lParamInit); } + +LONG_PTR _SetWindowLongPtrW(HWND hWnd, int nIndex, LONG_PTR dwNewLong) +{ + if (pSetWindowLongPtrW != NULL) { + return pSetWindowLongPtrW(hWnd, nIndex, dwNewLong); + } + return SetWindowLongPtr(hWnd, nIndex, dwNewLong); +} + Modified: trunk/teraterm/common/layer_for_unicode.h =================================================================== --- trunk/teraterm/common/layer_for_unicode.h 2020-03-12 01:35:06 UTC (rev 8589) +++ trunk/teraterm/common/layer_for_unicode.h 2020-03-12 13:51:56 UTC (rev 8590) @@ -108,6 +108,7 @@ HWND _HtmlHelpW(HWND hwndCaller, LPCWSTR pszFile, UINT uCommand, DWORD_PTR dwData); int _GetWindowTextW(HWND hWnd, LPWSTR lpString, int nMaxCount); int _GetWindowTextLengthW(HWND hWnd); +LONG_PTR _SetWindowLongPtrW(HWND hWnd, int nIndex, LONG_PTR dwNewLong); // gdi32.lib int _AddFontResourceW(LPCWSTR lpFileName); Modified: trunk/ttssh2/ttxssh/ttxssh.c =================================================================== --- trunk/ttssh2/ttxssh/ttxssh.c 2020-03-12 01:35:06 UTC (rev 8589) +++ trunk/ttssh2/ttxssh/ttxssh.c 2020-03-12 13:51:56 UTC (rev 8590) @@ -2371,7 +2371,7 @@ { wchar_t *strW = ToWcharU8(buf2); - SetDlgItemTextW(dlg, IDC_ABOUTTEXT, strW); + _SetDlgItemTextW(dlg, IDC_ABOUTTEXT, strW); free(strW); } } @@ -2495,7 +2495,7 @@ // Edit control\x82\xF0\x83T\x83u\x83N\x83\x89\x83X\x89\xBB\x82\xB7\x82\xE9\x81B g_deltaSumAboutDlg = 0; - g_defAboutDlgEditWndProc = (WNDPROC)SetWindowLongPtr(GetDlgItem(dlg, IDC_ABOUTTEXT), GWLP_WNDPROC, (LONG_PTR)AboutDlgEditWindowProc); + g_defAboutDlgEditWndProc = (WNDPROC)_SetWindowLongPtrW(GetDlgItem(dlg, IDC_ABOUTTEXT), GWLP_WNDPROC, (LONG_PTR)AboutDlgEditWindowProc); CenterWindow(dlg, GetParent(dlg));