[Ttssh2-commit] [8479] 終了時のダイアログを多言語化

scmno****@osdn***** scmno****@osdn*****
2020年 1月 16日 (木) 23:21:06 JST


Revision: 8479
          https://osdn.net/projects/ttssh2/scm/svn/commits/8479
Author:   zmatsuo
Date:     2020-01-16 23:21:06 +0900 (Thu, 16 Jan 2020)
Log Message:
-----------
終了時のダイアログを多言語化

- _MessageBoxW() 追加
- pDialogBoxIndirectParamW() 追加
- pHtmlHelpA(), pHtmlHelpW() 追加

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/teraterm/teraterm/vtwin.cpp
    trunk/teraterm/teraterm/vtwin.h

-------------- next part --------------
Modified: trunk/teraterm/common/compat_win.cpp
===================================================================
--- trunk/teraterm/common/compat_win.cpp	2020-01-16 14:20:53 UTC (rev 8478)
+++ trunk/teraterm/common/compat_win.cpp	2020-01-16 14:21:06 UTC (rev 8479)
@@ -1,5 +1,5 @@
 /*
- * (C) 20018-2019 TeraTerm Project
+ * (C) 2018-2020 TeraTerm Project
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -65,7 +65,12 @@
 BOOL (WINAPI *pAdjustWindowRectEx)(LPRECT lpRect, DWORD dwStyle, BOOL bMenu, DWORD dwExStyle);
 BOOL (WINAPI *pAdjustWindowRectExForDpi)(LPRECT lpRect, DWORD dwStyle, BOOL bMenu, DWORD dwExStyle, UINT dpi);
 HWND (WINAPI *pGetConsoleWindow)(void);
+int (WINAPI *pMessageBoxW)(HWND hWnd, LPCWSTR lpText, LPCWSTR lpCaption, UINT uType);
+INT_PTR (WINAPI *pDialogBoxIndirectParamW)(HINSTANCE hInstance, LPCDLGTEMPLATEW hDialogTemplate, HWND hWndParent, DLGPROC lpDialogFunc, LPARAM dwInitParam);
 
+HWND (WINAPI *pHtmlHelpW)(HWND hwndCaller, LPCWSTR pszFile, UINT uCommand, DWORD_PTR dwData);
+HWND (WINAPI *pHtmlHelpA)(HWND hwndCaller, LPCSTR pszFile, UINT uCommand, DWORD_PTR dwData);
+
 /**
  *	GetConsoleWindow() \x82Ɠ\xAF\x82\xB6\x93\xAE\x8D\xEC\x82\xF0\x82\xB7\x82\xE9
  *	 https://support.microsoft.com/ja-jp/help/124103/how-to-obtain-a-console-window-handle-hwnd
@@ -119,6 +124,8 @@
 	{ "ModifyMenuW", (void **)&pModifyMenuW },
 	{ "GetMenuStringW", (void **)&pGetMenuStringW },
 	{ "SendDlgItemMessageW", (void **)&pSendDlgItemMessageW },
+	{ "MessageBoxW", (void **)&pMessageBoxW },
+	{ "DialogBoxIndirectParamW", (void **)&pDialogBoxIndirectParamW },
 	{},
 };
 
@@ -158,6 +165,12 @@
 	{},
 };
 
+static const APIInfo Lists_hhctrl[] = {
+	{ "HtmlHelpW", (void **)&pHtmlHelpW },
+	{ "HtmlHelpA", (void **)&pHtmlHelpA },
+	{},
+};
+
 static const DllInfo DllInfos[] = {
 	{ _T("user32.dll"), DLL_LOAD_LIBRARY_SYSTEM, DLL_ACCEPT_NOT_EXIST, Lists_user32 },
 	{ _T("msimg32.dll"), DLL_LOAD_LIBRARY_SYSTEM, DLL_ACCEPT_NOT_EXIST, Lists_msimg32 },
@@ -166,6 +179,7 @@
 	{ _T("kernel32.dll"), DLL_LOAD_LIBRARY_SYSTEM, DLL_ACCEPT_NOT_EXIST, Lists_kernel32 },
 	{ _T("shell32.dll"), DLL_LOAD_LIBRARY_SYSTEM, DLL_ACCEPT_NOT_EXIST, Lists_shell32 },
 	{ _T("Comctl32.dll"), DLL_LOAD_LIBRARY_SYSTEM, DLL_ACCEPT_NOT_EXIST, Lists_comctl32 },
+	{ _T("hhctrl.ocx"), DLL_LOAD_LIBRARY_SYSTEM, DLL_ACCEPT_NOT_EXIST, Lists_hhctrl },
 	{},
 };
 

Modified: trunk/teraterm/common/compat_win.h
===================================================================
--- trunk/teraterm/common/compat_win.h	2020-01-16 14:20:53 UTC (rev 8478)
+++ trunk/teraterm/common/compat_win.h	2020-01-16 14:21:06 UTC (rev 8479)
@@ -1,5 +1,5 @@
 /*
- * (C) 2018-2019 TeraTerm Project
+ * (C) 2018-2020 TeraTerm Project
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -98,6 +98,10 @@
 extern BOOL (WINAPI *pRemoveFontResourceExA)(LPCSTR name, DWORD fl, PVOID pdv);
 extern BOOL (WINAPI *pRemoveFontResourceExW)(LPCWSTR name, DWORD fl, PVOID pdv);
 extern HWND (WINAPI *pGetConsoleWindow)(void);
+extern int (WINAPI *pMessageBoxW)(HWND hWnd, LPCWSTR lpText, LPCWSTR lpCaption, UINT uType);
+extern INT_PTR (WINAPI *pDialogBoxIndirectParamW)(HINSTANCE hInstance, LPCDLGTEMPLATEW hDialogTemplate, HWND hWndParent, DLGPROC lpDialogFunc, LPARAM dwInitParam);
+extern HWND (WINAPI *pHtmlHelpW)(HWND hwndCaller, LPCWSTR pszFile, UINT uCommand, DWORD_PTR dwData);
+extern HWND (WINAPI *pHtmlHelpA)(HWND hwndCaller, LPCSTR pszFile, UINT uCommand, DWORD_PTR dwData);
 
 #ifdef UNICODE
 #define pAddFontResourceEx		pAddFontResourceExW

Modified: trunk/teraterm/common/layer_for_unicode.cpp
===================================================================
--- trunk/teraterm/common/layer_for_unicode.cpp	2020-01-16 14:20:53 UTC (rev 8478)
+++ trunk/teraterm/common/layer_for_unicode.cpp	2020-01-16 14:21:06 UTC (rev 8479)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2019 TeraTerm Project
+ * Copyright (C) 2019-2020 TeraTerm Project
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -302,3 +302,17 @@
 	free(strA);
 	return result;
 }
+
+int _MessageBoxW(HWND hWnd, LPCWSTR lpText, LPCWSTR lpCaption, UINT uType)
+{
+	if (pMessageBoxW != NULL) {
+		return pMessageBoxW(hWnd, lpText, lpCaption, uType);
+	}
+
+	char *textA = ToCharW(lpText);
+	char *captionA = ToCharW(lpCaption);
+	int result = MessageBoxA(hWnd, textA, captionA, uType);
+	free(textA);
+	free(captionA);
+	return result;
+}

Modified: trunk/teraterm/common/layer_for_unicode.h
===================================================================
--- trunk/teraterm/common/layer_for_unicode.h	2020-01-16 14:20:53 UTC (rev 8478)
+++ trunk/teraterm/common/layer_for_unicode.h	2020-01-16 14:21:06 UTC (rev 8479)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2019 TeraTerm Project
+ * Copyright (C) 2019-2020 TeraTerm Project
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -54,6 +54,7 @@
 							 LPVOID lpParam);
 ATOM _RegisterClassW(const WNDCLASSW *lpWndClass);
 int _DrawTextW(HDC hdc, LPCWSTR lpchText, int cchText, LPRECT lprc, UINT format);
+int _MessageBoxW(HWND hWnd, LPCWSTR lpText, LPCWSTR lpCaption, UINT uType);
 
 #ifdef __cplusplus
 }

Modified: trunk/teraterm/teraterm/vtwin.cpp
===================================================================
--- trunk/teraterm/teraterm/vtwin.cpp	2020-01-16 14:20:53 UTC (rev 8478)
+++ trunk/teraterm/teraterm/vtwin.cpp	2020-01-16 14:21:06 UTC (rev 8479)
@@ -1,6 +1,6 @@
 /*
  * Copyright (C) 1994-1998 T. Teranishi
- * (C) 2004-2019 TeraTerm Project
+ * (C) 2004-2020 TeraTerm Project
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -1693,14 +1693,18 @@
 		MessageBeep(0);
 		return;
 	}
-	get_lang_msg("MSG_DISCONNECT_CONF", ts.UIMsg, sizeof(ts.UIMsg),
-	             "Disconnect?", ts.UILanguageFile);
+
 	if (cv.Ready && (cv.PortType==IdTCPIP) &&
 	    ((ts.PortFlag & PF_CONFIRMDISCONN) != 0) &&
-	    ! CloseTT &&
-	    (::MessageBox(HVTWin, ts.UIMsg, "Tera Term",
-	     MB_OKCANCEL | MB_ICONEXCLAMATION | MB_DEFBUTTON2)==IDCANCEL)) {
-		return;
+	    ! CloseTT) {
+		wchar_t uimsg[MAX_UIMSG];
+		get_lang_msgW("MSG_DISCONNECT_CONF", uimsg, _countof(uimsg),
+					  L"Disconnect?", ts.UILanguageFile);
+		int result = _MessageBoxW(HVTWin, uimsg, L"Tera Term",
+								  MB_OKCANCEL | MB_ICONEXCLAMATION | MB_DEFBUTTON2);
+		if (result == IDCANCEL) {
+			return;
+		}
 	}
 
 	FileTransEnd(0);

Modified: trunk/teraterm/teraterm/vtwin.h
===================================================================
--- trunk/teraterm/teraterm/vtwin.h	2020-01-16 14:20:53 UTC (rev 8478)
+++ trunk/teraterm/teraterm/vtwin.h	2020-01-16 14:21:06 UTC (rev 8479)
@@ -1,6 +1,6 @@
 /*
  * Copyright (C) 1994-1998 T. Teranishi
- * (C) 2004-2019 TeraTerm Project
+ * (C) 2004-2020 TeraTerm Project
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without


Ttssh2-commit メーリングリストの案内