[Ttssh2-commit] [8472] DialogBoxIndirectParamW() を使用

scmno****@osdn***** scmno****@osdn*****
2020年 1月 14日 (火) 01:26:17 JST


Revision: 8472
          https://osdn.net/projects/ttssh2/scm/svn/commits/8472
Author:   zmatsuo
Date:     2020-01-14 01:26:16 +0900 (Tue, 14 Jan 2020)
Log Message:
-----------
DialogBoxIndirectParamW() を使用

- ダイアログのタイトルバーが文字化けする場合があった
- 可能なら DialogBoxIndirectParamW() を使用する
  - 使用できなければ従来どおり DialogBoxIndirectParamA() を使用する

Modified Paths:
--------------
    trunk/teraterm/common/dlglib_cpp.cpp

-------------- next part --------------
Modified: trunk/teraterm/common/dlglib_cpp.cpp
===================================================================
--- trunk/teraterm/common/dlglib_cpp.cpp	2020-01-13 16:26:06 UTC (rev 8471)
+++ trunk/teraterm/common/dlglib_cpp.cpp	2020-01-13 16:26:16 UTC (rev 8472)
@@ -1,5 +1,5 @@
 /*
- * (C) 2005-2019 TeraTerm Project
+ * (C) 2005-2020 TeraTerm Project
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -225,9 +225,25 @@
 	return DlgResult;
 #else
 	DLGTEMPLATE *lpTemplate = TTGetDlgTemplate(hInstance, lpTemplateName);
-	INT_PTR DlgResult = DialogBoxIndirectParam(
-		hInstance, lpTemplate, hWndParent,
-		lpDialogFunc, lParamInit);
+	INT_PTR DlgResult;
+	static INT_PTR (WINAPI *pDialogBoxIndirectParamW)(HINSTANCE hInstance, LPCDLGTEMPLATEW hDialogTemplate, HWND hWndParent, DLGPROC lpDialogFunc, LPARAM dwInitParam);
+
+	if (pDialogBoxIndirectParamW == NULL) {
+		HMODULE hDll = LoadLibrary("user32.dll");
+		FARPROC *proc = (FARPROC *)&pDialogBoxIndirectParamW;
+		*proc = GetProcAddress(hDll, "DialogBoxIndirectParamW");
+	}
+
+	if (pDialogBoxIndirectParamW == NULL) {
+		DlgResult = DialogBoxIndirectParamA(
+			hInstance, lpTemplate, hWndParent,
+			lpDialogFunc, lParamInit);
+	}
+	else {
+		DlgResult = pDialogBoxIndirectParamW(
+			hInstance, lpTemplate, hWndParent,
+			lpDialogFunc, lParamInit);
+	}
 	free(lpTemplate);
 	return DlgResult;
 #endif


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