• R/O
  • SSH
  • HTTPS

ttssh2: Commit


Commit MetaInfo

Revision8552 (tree)
Zeit2020-02-20 00:38:18
Autorzmatsuo

Log Message

About TTProxy ダイアログの文字化けを修正

Ändern Zusammenfassung

Diff

--- trunk/TTProxy/ProxyWSockHook.h (revision 8551)
+++ trunk/TTProxy/ProxyWSockHook.h (revision 8552)
@@ -17,6 +17,7 @@
1717
1818 #include "ttlib.h"
1919 #include "i18n.h"
20+#include "layer_for_unicode.h"
2021
2122 extern char UILanguageFile[MAX_PATH];
2223
@@ -25,6 +26,11 @@
2526 GetI18nStr("TTProxy", key, buf, buf_len, def, UILanguageFile);
2627 }
2728
29+void UTIL_get_lang_msgW(const char *key, wchar_t *buf, int buf_len, const wchar_t *def)
30+{
31+ GetI18nStrW("TTProxy", key, buf, buf_len, def, UILanguageFile);
32+}
33+
2834 class ProxyWSockHook {
2935 public:
3036 class MessageShower {
@@ -1069,25 +1075,29 @@
10691075 class AboutDialog : public Dialog {
10701076 private:
10711077 virtual bool onInitDialog() {
1072- String buf;
1073- char *buf2;
1078+ wchar_t buf[MAX_UIMSG];
1079+ wchar_t *buf2;
10741080 const char *ver;
1075- int n, a, b, c, d, len;
1076- char uimsg[MAX_UIMSG], uimsg2[MAX_UIMSG], uimsg3[MAX_UIMSG];
1081+ int n, a, b, c, d;
1082+ size_t len;
1083+ wchar_t uimsg[MAX_UIMSG], uimsg2[MAX_UIMSG], uimsg3[MAX_UIMSG];
1084+ HWND hWnd = (HWND)*this;
10771085
1078- GetWindowText(uimsg2, sizeof(uimsg2));
1079- UTIL_get_lang_msg("DLG_ABOUT_TITLE", uimsg, sizeof(uimsg), uimsg2);
1080- SetWindowText(uimsg);
1086+ const static DlgTextInfo text_info[] = {
1087+ { 0, "DLG_ABOUT_TITLE" },
1088+ { IDOK, "BTN_OK" },
1089+ };
1090+ SetI18nDlgStrs("TTProxy", hWnd, text_info, _countof(text_info), UILanguageFile);
10811091
1082- UTIL_get_lang_msg("DLG_ABOUT_EXTENSION", uimsg, sizeof(uimsg),
1083- "Tera Term proxy extension");
1084- UTIL_get_lang_msg("DLG_ABOUT_YEBISUYA", uimsg2, sizeof(uimsg2),
1085- "YebisuyaHompo");
1086- UTIL_get_lang_msg("DLG_ABOUT_HOMEPAGE", uimsg3, sizeof(uimsg3),
1087- "TTProxy home page");
1088- buf = GetDlgItemText(IDC_VERSION);
1089- len = buf.length() + 50;
1090- buf2 = (char *)_alloca(len);
1092+ UTIL_get_lang_msgW("DLG_ABOUT_EXTENSION", uimsg, sizeof(uimsg),
1093+ L"Tera Term proxy extension");
1094+ UTIL_get_lang_msgW("DLG_ABOUT_YEBISUYA", uimsg2, sizeof(uimsg2),
1095+ L"YebisuyaHompo");
1096+ UTIL_get_lang_msgW("DLG_ABOUT_HOMEPAGE", uimsg3, sizeof(uimsg3),
1097+ L"TTProxy home page");
1098+ _GetDlgItemTextW(hWnd, IDC_VERSION, buf, _countof(buf));
1099+ len = wcslen(buf) + 50;
1100+ buf2 = (wchar_t *)_alloca(sizeof(wchar_t) * len);
10911101 if (buf2 == NULL) {
10921102 return true;
10931103 }
@@ -1094,16 +1104,12 @@
10941104 ver = FileVersion::getOwnVersion().getFileVersion();
10951105 n = sscanf_s(ver, "%d, %d, %d, %d", &a, &b, &c, &d);
10961106 if (n == 4) {
1097- sprintf_s(buf2, len, buf, uimsg, a, b, c, d, uimsg2, uimsg3);
1107+ swprintf_s(buf2, len, buf, uimsg, a, b, c, d, uimsg2, uimsg3);
10981108 }
1099- SetDlgItemText(IDC_VERSION, (n == 4) ? buf2 : buf);
1109+ _SetDlgItemTextW(hWnd, IDC_VERSION, (n == 4) ? buf2 : buf);
11001110
1101- GetDlgItemText(IDOK, uimsg, sizeof(uimsg));
1102- UTIL_get_lang_msg("BTN_OK", uimsg, sizeof(uimsg),"OK");
1103- SetDlgItemText(IDOK, uimsg);
1111+ CenterWindow(hWnd, GetParent());
11041112
1105- CenterWindow((HWND)*this, GetParent());
1106-
11071113 return true;
11081114 }
11091115 virtual void onOK() {
Show on old repository browser