[Ttssh2-commit] [7515] ttpdlg内のダイアログを高Dpi対応

scmno****@osdn***** scmno****@osdn*****
2019年 3月 27日 (水) 00:42:43 JST


Revision: 7515
          http://sourceforge.jp/projects/ttssh2/scm/svn/commits/7515
Author:   zmatsuo
Date:     2019-03-27 00:42:43 +0900 (Wed, 27 Mar 2019)
Log Message:
-----------
ttpdlg内のダイアログを高Dpi対応
ttpdlg.dllをtterm.exeに統合
(installer/teraterm.issは未着手)

Modified Paths:
--------------
    trunk/CMakeLists.txt
    trunk/teraterm/CMakeLists.txt
    trunk/teraterm/teraterm/CMakeLists.txt
    trunk/teraterm/teraterm/ttdialog.c
    trunk/teraterm/teraterm/vtwin.cpp
    trunk/teraterm/ttpdlg/ttdlg.c
    trunk/teraterm/ttpdlg/ttpdlg.rc

Added Paths:
-----------
    trunk/teraterm/teraterm/svnversion.h.in
    trunk/teraterm/ttpdlg/ttdlg.h

Removed Paths:
-------------
    trunk/teraterm/ttpdlg/CMakeLists.txt
    trunk/teraterm/ttpdlg/svnversion.h.in
    trunk/teraterm/ttpdlg/ttpdlg-version.rc

-------------- next part --------------
Modified: trunk/CMakeLists.txt
===================================================================
--- trunk/CMakeLists.txt	2019-03-26 15:42:29 UTC (rev 7514)
+++ trunk/CMakeLists.txt	2019-03-26 15:42:43 UTC (rev 7515)
@@ -86,3 +86,12 @@
 if(${ENABLE_TTXSAMPLES})
   add_subdirectory(TTXSamples)
 endif()
+
+####
+# ソースツリー内に生成ファイルが存在していたら削除する
+if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/teraterm/ttpdlg/svnversion.h")
+  file(REMOVE "${CMAKE_CURRENT_SOURCE_DIR}/teraterm/ttpdlg/svnversion.h")
+endif()
+if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/ttssh2/ttxssh/puttyversion.h")
+  file(REMOVE "${CMAKE_CURRENT_SOURCE_DIR}/ttssh2/ttxssh/puttyversion.h")
+endif()

Modified: trunk/teraterm/CMakeLists.txt
===================================================================
--- trunk/teraterm/CMakeLists.txt	2019-03-26 15:42:29 UTC (rev 7514)
+++ trunk/teraterm/CMakeLists.txt	2019-03-26 15:42:43 UTC (rev 7515)
@@ -4,11 +4,6 @@
   ttpcmn
   PROPERTIES FOLDER teraterm)
 
-add_subdirectory(ttpdlg)
-set_target_properties(
-  ttpdlg
-  PROPERTIES FOLDER teraterm)
-
 add_subdirectory(ttpfile)
 set_target_properties(
   ttpfile

Modified: trunk/teraterm/teraterm/CMakeLists.txt
===================================================================
--- trunk/teraterm/teraterm/CMakeLists.txt	2019-03-26 15:42:29 UTC (rev 7514)
+++ trunk/teraterm/teraterm/CMakeLists.txt	2019-03-26 15:42:43 UTC (rev 7515)
@@ -53,6 +53,19 @@
   ${COMMON_SRC}
   )
 
+set(TTDLG_SRC
+  ../ttpdlg/dlg_res.h
+  ../ttpdlg/ttdlg.c
+  ../ttpdlg/ttdlg.h
+  ../ttpdlg/ttpdlg.rc
+  )
+
+source_group(
+  "ttdlg"
+  FILES
+  ${TTDLG_SRC}
+  )
+
 set(SRC
   addsetting.cpp
   addsetting.h
@@ -119,12 +132,17 @@
   #
   teraterm.manifest
   #
+  svnversion.h.in
+  ${CMAKE_CURRENT_BINARY_DIR}/svnversion.h
+  #
   ${COMMON_SRC}
+  ${TTDLG_SRC}
   )
 
 include_directories(
   ../common
   ../ttpfile
+  ../ttpdlg
   ${SFMT_INCLUDE_DIRS}
   ${ONIGURUMA_INCLUDE_DIRS}
   .
@@ -158,7 +176,6 @@
 target_link_libraries(
   teraterm
   ttpcmn
-  ttpdlg
   ttpfile
   ttpset
   ttptek
@@ -180,12 +197,15 @@
 add_dependencies(
   teraterm
   ttpcmn
-  ttpdlg
   ttpfile
   ttpset
   ttptek
   )
 
+configure_file(
+  svnversion.h.in
+  svnversion.h @ONLY)
+
 # copy .lng files
 if(${CMAKE_GENERATOR} MATCHES "Visual Studio 15 2017")
   add_custom_target(
@@ -241,3 +261,8 @@
       "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}$(Configuration)/lang/Traditional Chinese.lng"
     )
 endif()
+
+####
+configure_file(
+  svnversion.h.in
+  svnversion.h @ONLY)

Copied: trunk/teraterm/teraterm/svnversion.h.in (from rev 7514, trunk/teraterm/ttpdlg/svnversion.h.in)
===================================================================
--- trunk/teraterm/teraterm/svnversion.h.in	                        (rev 0)
+++ trunk/teraterm/teraterm/svnversion.h.in	2019-03-26 15:42:43 UTC (rev 7515)
@@ -0,0 +1 @@
+#cmakedefine SVNVERSION @SVNVERSION@

Modified: trunk/teraterm/teraterm/ttdialog.c
===================================================================
--- trunk/teraterm/teraterm/ttdialog.c	2019-03-26 15:42:29 UTC (rev 7514)
+++ trunk/teraterm/teraterm/ttdialog.c	2019-03-26 15:42:43 UTC (rev 7515)
@@ -1,6 +1,6 @@
 /*
  * Copyright (C) 1994-1998 T. Teranishi
- * (C) 2007-2017 TeraTerm Project
+ * (C) 2007-2019 TeraTerm Project
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -31,13 +31,11 @@
 #include "teraterm.h"
 #include "tttypes.h"
 #include "ttplug.h" /* TTPLUG */
+#include "ttdlg.h"
 
 #include "ttdialog.h"
 #include "ttwinman.h"
 
-static HMODULE HTTDLG = NULL;
-static TTDLGUseCount = 0;
-
 PSetupTerminal SetupTerminal;
 PSetupWin SetupWin;
 PSetupKeyboard SetupKeyboard;
@@ -51,131 +49,29 @@
 PWindowWindow WindowWindow;
 PTTDLGSetUILanguageFile TTDLGSetUILanguageFile;
 
-#define IdSetupTerminal   1
-#define IdSetupWin        2
-#define IdSetupKeyboard   3
-#define IdSetupSerialPort 4
-#define IdSetupTCPIP      5
-#define IdGetHostName     6
-#define IdChangeDirectory 7
-#define IdAboutDialog     8
-#define IdChooseFontDlg   9
-#define IdSetupGeneral    10
-#define IdWindowWindow    11
-#define IdTTDLGSetUILanguageFile  12
-
 BOOL LoadTTDLG()
 {
-	BOOL Err;
+	SetupTerminal = _SetupTerminal;
+	SetupWin = _SetupWin;
+	SetupKeyboard = _SetupKeyboard;
+	SetupSerialPort = _SetupSerialPort;
+	SetupTCPIP = _SetupTCPIP;
+	GetHostName = _GetHostName;
+	ChangeDirectory = _ChangeDirectory;
+	AboutDialog = _AboutDialog;
+	ChooseFontDlg = _ChooseFontDlg;
+	SetupGeneral = _SetupGeneral;
+	WindowWindow = _WindowWindow;
+	TTDLGSetUILanguageFile = _TTDLGSetUILanguageFile;
 
-	if (HTTDLG == NULL) {
-		TTDLGUseCount = 0;
+	TTDLGSetUILanguageFile(ts.UILanguageFile);
+	TTXGetUIHooks(); /* TTPLUG */
 
-		HTTDLG = LoadHomeDLL("TTPDLG.DLL");
-		if (HTTDLG==NULL) return FALSE;
-
-		Err = FALSE;
-
-		SetupTerminal = (PSetupTerminal)GetProcAddress(HTTDLG,
-		  MAKEINTRESOURCE(IdSetupTerminal));
-		if (SetupTerminal==NULL) {
-			Err = TRUE;
-		}
-
-		SetupWin = (PSetupWin)GetProcAddress(HTTDLG,
-		  MAKEINTRESOURCE(IdSetupWin));
-		if (SetupWin==NULL) {
-			Err = TRUE;
-		}
-
-		SetupKeyboard = (PSetupKeyboard)GetProcAddress(HTTDLG,
-		  MAKEINTRESOURCE(IdSetupKeyboard));
-		if (SetupKeyboard==NULL) {
-			Err = TRUE;
-		}
-
-		SetupSerialPort = (PSetupSerialPort)GetProcAddress(HTTDLG,
-		  MAKEINTRESOURCE(IdSetupSerialPort));
-		if (SetupSerialPort==NULL) {
-			Err = TRUE;
-		}
-
-		SetupTCPIP = (PSetupTCPIP)GetProcAddress(HTTDLG,
-		  MAKEINTRESOURCE(IdSetupTCPIP));
-		if (SetupTCPIP==NULL) {
-			Err = TRUE;
-		}
-
-		GetHostName = (PGetHostName)GetProcAddress(HTTDLG,
-		  MAKEINTRESOURCE(IdGetHostName));
-		if (GetHostName==NULL) {
-			Err = TRUE;
-		}
-
-		ChangeDirectory = (PChangeDirectory)GetProcAddress(HTTDLG,
-		  MAKEINTRESOURCE(IdChangeDirectory));
-		if (ChangeDirectory==NULL) {
-			Err = TRUE;
-		}
-
-		AboutDialog = (PAboutDialog)GetProcAddress(HTTDLG,
-		  MAKEINTRESOURCE(IdAboutDialog));
-		if (AboutDialog==NULL) {
-			Err = TRUE;
-		}
-
-		ChooseFontDlg = (PChooseFontDlg)GetProcAddress(HTTDLG,
-		  MAKEINTRESOURCE(IdChooseFontDlg));
-		if (ChooseFontDlg==NULL) {
-			Err = TRUE;
-		}
-
-		SetupGeneral = (PSetupGeneral)GetProcAddress(HTTDLG,
-		  MAKEINTRESOURCE(IdSetupGeneral));
-		if (SetupGeneral==NULL) {
-			Err = TRUE;
-		}
-
-		WindowWindow = (PWindowWindow)GetProcAddress(HTTDLG,
-		  MAKEINTRESOURCE(IdWindowWindow));
-		if (WindowWindow==NULL) {
-			Err = TRUE;
-		}
-
-		TTDLGSetUILanguageFile = (PTTDLGSetUILanguageFile)GetProcAddress(HTTDLG,
-		  MAKEINTRESOURCE(IdTTDLGSetUILanguageFile));
-		if (TTDLGSetUILanguageFile==NULL) {
-			Err = TRUE;
-		}
-		else {
-			TTDLGSetUILanguageFile(ts.UILanguageFile);
-		}
-
-		if (Err) {
-			FreeLibrary(HTTDLG);
-			HTTDLG = NULL;
-			return FALSE;
-		}
-
-		TTXGetUIHooks(); /* TTPLUG */
-	}
-	TTDLGUseCount++;
 	return TRUE;
 }
 
 BOOL FreeTTDLG()
 {
-	if (TTDLGUseCount==0) {
-		return FALSE;
-	}
-	TTDLGUseCount--;
-	if (TTDLGUseCount>0) {
-		return TRUE;
-	}
-	if (HTTDLG!=NULL) {
-		FreeLibrary(HTTDLG);
-		HTTDLG = NULL;
-	}
-	return FALSE;
+	return TRUE;
 }
 

Modified: trunk/teraterm/teraterm/vtwin.cpp
===================================================================
--- trunk/teraterm/teraterm/vtwin.cpp	2019-03-26 15:42:29 UTC (rev 7514)
+++ trunk/teraterm/teraterm/vtwin.cpp	2019-03-26 15:42:43 UTC (rev 7515)
@@ -1991,8 +1991,10 @@
 
 	FreeIME(HVTWin);
 	FreeTTSET();
+#if 0	// free\x82Ɏ\xB8\x94s\x82\xB7\x82\xE9\x82܂\xC5free\x82\xB5\x91\xB1\x82\xAF\x82\xE9
 	do { }
 	while (FreeTTDLG());
+#endif
 
 	do { }
 	while (FreeTTFILE());

Deleted: trunk/teraterm/ttpdlg/CMakeLists.txt
===================================================================
--- trunk/teraterm/ttpdlg/CMakeLists.txt	2019-03-26 15:42:29 UTC (rev 7514)
+++ trunk/teraterm/ttpdlg/CMakeLists.txt	2019-03-26 15:42:43 UTC (rev 7515)
@@ -1,79 +0,0 @@
-project(ttpdlg)
-
-include(${CMAKE_CURRENT_SOURCE_DIR}/../../libs/lib_oniguruma.cmake)
-
-set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/")
-
-if(MINGW)
-  set(CMAKE_RC_FLAGS "${CMAKE_RC_FLAGS} -I ${CMAKE_CURRENT_SOURCE_DIR}/../common")
-else()
-  set(CMAKE_RC_FLAGS "${CMAKE_RC_FLAGS} /i ${CMAKE_CURRENT_SOURCE_DIR}/../common")
-endif()
-
-set(COMMON_SRC
-  ../common/dlglib.c
-  ../common/dlglib.h
-  ../common/dlglib_tmpl.cpp
-  ../common/ttlib.c
-  ../common/ttlib.h
-  ../common/teraterm.ico
-  )
-
-source_group(
-  "common"
-  FILES
-  ${COMMON_SRC}
-  )
-
-set(SRC
-  dlg_res.h
-  ttdlg.c
-  ttpdlg.def
-  ttpdlg.rc
-  ttpdlg-version.rc
-  ${CMAKE_CURRENT_BINARY_DIR}/svnversion.h
-  ${COMMON_SRC}
-  )
-
-include_directories(
-  ${CMAKE_CURRENT_SOURCE_DIR}/../common
-  ${CMAKE_CURRENT_BINARY_DIR}
-  ${ONIGURUMA_INCLUDE_DIRS}
-  )
-
-link_directories(
-  ${ONIGURUMA_LIBRARY_DIRS}
-  )
-
-add_library(
-  ttpdlg SHARED
-  ${SRC}
-  )
-
-if(MINGW)
-  set_target_properties(
-    ttpdlg
-    PROPERTIES PREFIX ""
-    SUFFIX ".dll"
-    )
-endif()
-
-target_link_libraries(
-  ttpdlg
-  ttpcmn
-  optimized onig.lib
-  debug onigd.lib
-  )
-
-add_dependencies(
-  ttpdlg
-  ttpcmn
-  )
-
-configure_file(
-  svnversion.h.in
-  svnversion.h @ONLY)
-
-if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/svnversion.h")
-  file(REMOVE "${CMAKE_CURRENT_SOURCE_DIR}/svnversion.h")
-endif()

Deleted: trunk/teraterm/ttpdlg/svnversion.h.in
===================================================================
--- trunk/teraterm/ttpdlg/svnversion.h.in	2019-03-26 15:42:29 UTC (rev 7514)
+++ trunk/teraterm/ttpdlg/svnversion.h.in	2019-03-26 15:42:43 UTC (rev 7515)
@@ -1 +0,0 @@
-#cmakedefine SVNVERSION @SVNVERSION@

Modified: trunk/teraterm/ttpdlg/ttdlg.c
===================================================================
--- trunk/teraterm/ttpdlg/ttdlg.c	2019-03-26 15:42:29 UTC (rev 7514)
+++ trunk/teraterm/ttpdlg/ttdlg.c	2019-03-26 15:42:43 UTC (rev 7515)
@@ -1,6 +1,6 @@
 /*
  * Copyright (C) 1994-1998 T. Teranishi
- * (C) 2004-2018 TeraTerm Project
+ * (C) 2004-2019 TeraTerm Project
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -45,6 +45,7 @@
 #include "ttcommon.h"
 #include "dlg_res.h"
 #include "svnversion.h"
+#include "ttdlg.h"
 
 // Oniguruma: Regular expression library
 #define ONIG_EXTERN extern
@@ -55,7 +56,7 @@
 #undef EFFECT_ENABLED	// \x83G\x83t\x83F\x83N\x83g\x82̗L\x8C\xF8\x89”\xDB
 #undef TEXTURE_ENABLED	// \x83e\x83N\x83X\x83`\x83\x83\x82̗L\x8C\xF8\x89”\xDB
 
-#include "compat_w95.h"
+//#include "compat_w95.h"
 
 #ifdef _DEBUG
 #define calloc(c, s)  _calloc_dbg((c), (s), _NORMAL_BLOCK, __FILE__, __LINE__)
@@ -63,18 +64,18 @@
 #define _strdup(s)	  _strdup_dbg((s), _NORMAL_BLOCK, __FILE__, __LINE__)
 #endif
 
-static HANDLE hInst;
+#undef DialogBoxParam
+#define DialogBoxParam(p1,p2,p3,p4,p5) \
+	TTDialogBoxParam(p1,p2,p3,p4,p5)
+#undef DialogBox
+#define DialogBox(p1,p2,p3,p4) \
+	TTDialogBox(p1,p2,p3,p4)
+#undef EndDialog
+#define EndDialog(p1,p2) \
+	TTEndDialog(p1, p2)
 
-static HFONT DlgAboutFont;
-static HFONT DlgDirFont;
-static HFONT DlgGenFont;
-static HFONT DlgHostFont;
-static HFONT DlgKeybFont;
-static HFONT DlgSerialFont;
-static HFONT DlgTcpipFont;
-static HFONT DlgTermFont;
-static HFONT DlgWinFont;
-static HFONT DlgWinlistFont;
+//static HANDLE hInst;
+extern HANDLE hInst;
 
 char UILanguageFile[MAX_PATH];
 
@@ -116,169 +117,63 @@
 	 "230400", "460800", "921600", NULL};
 
 
-BOOL CALLBACK TermDlg(HWND Dialog, UINT Message, WPARAM wParam, LPARAM lParam)
+static INT_PTR CALLBACK TermDlg(HWND Dialog, UINT Message, WPARAM wParam, LPARAM lParam)
 {
+	static const DlgTextInfo TextInfosCom[] = {
+		{ 0, "DLG_TERM_TITLE" },
+		{ IDC_TERMWIDTHLABEL, "DLG_TERM_WIDTHLABEL" },
+		{ IDC_TERMISWIN, "DLG_TERM_ISWIN" },
+		{ IDC_TERMRESIZE, "DLG_TERM_RESIZE" },
+		{ IDC_TERMNEWLINE, "DLG_TERM_NEWLINE" },
+		{ IDC_TERMCRRCVLABEL, "DLG_TERM_CRRCV" },
+		{ IDC_TERMCRSENDLABEL, "DLG_TERM_CRSEND" },
+		{ IDC_TERMIDLABEL, "DLG_TERM_ID" },
+		{ IDC_TERMLOCALECHO, "DLG_TERM_LOCALECHO" },
+		{ IDC_TERMANSBACKTEXT, "DLG_TERM_ANSBACK" },
+		{ IDC_TERMAUTOSWITCH, "DLG_TERM_AUTOSWITCH" },
+		{ IDOK, "BTN_OK" },
+		{ IDCANCEL, "BTN_CANCEL" },
+		{ IDC_TERMHELP, "BTN_HELP" },
+	};
 	PTTSet ts;
 	WORD w;
 	//  char Temp[HostNameMaxLength + 1]; // 81(yutaka)
 	char Temp[81]; // 81(yutaka)
-	char uimsg[MAX_UIMSG], uimsg2[MAX_UIMSG];
-	LOGFONT logfont;
-	HFONT font;
 
 	switch (Message) {
 		case WM_INITDIALOG:
 			ts = (PTTSet)lParam;
-			SetWindowLong(Dialog, DWL_USER, lParam);
+			SetWindowLongPtr(Dialog, DWLP_USER, lParam);
 
-			font = (HFONT)SendMessage(Dialog, WM_GETFONT, 0, 0);
-			GetObject(font, sizeof(LOGFONT), &logfont);
-			if (get_lang_font("DLG_SYSTEM_FONT", Dialog, &logfont, &DlgTermFont, UILanguageFile)) {
-				SendDlgItemMessage(Dialog, IDC_TERMWIDTHLABEL, WM_SETFONT, (WPARAM)DlgTermFont, MAKELPARAM(TRUE,0));
-				SendDlgItemMessage(Dialog, IDC_TERMWIDTH, WM_SETFONT, (WPARAM)DlgTermFont, MAKELPARAM(TRUE,0));
-				SendDlgItemMessage(Dialog, IDC_TERMX, WM_SETFONT, (WPARAM)DlgTermFont, MAKELPARAM(TRUE,0));
-				SendDlgItemMessage(Dialog, IDC_TERMHEIGHT, WM_SETFONT, (WPARAM)DlgTermFont, MAKELPARAM(TRUE,0));
-				SendDlgItemMessage(Dialog, IDC_TERMISWIN, WM_SETFONT, (WPARAM)DlgTermFont, MAKELPARAM(TRUE,0));
-				SendDlgItemMessage(Dialog, IDC_TERMRESIZE, WM_SETFONT, (WPARAM)DlgTermFont, MAKELPARAM(TRUE,0));
-				SendDlgItemMessage(Dialog, IDC_TERMNEWLINE, WM_SETFONT, (WPARAM)DlgTermFont, MAKELPARAM(TRUE,0));
-				SendDlgItemMessage(Dialog, IDC_TERMCRRCVLABEL, WM_SETFONT, (WPARAM)DlgTermFont, MAKELPARAM(TRUE,0));
-				SendDlgItemMessage(Dialog, IDC_TERMCRRCV, WM_SETFONT, (WPARAM)DlgTermFont, MAKELPARAM(TRUE,0));
-				SendDlgItemMessage(Dialog, IDC_TERMCRSENDLABEL, WM_SETFONT, (WPARAM)DlgTermFont, MAKELPARAM(TRUE,0));
-				SendDlgItemMessage(Dialog, IDC_TERMCRSEND, WM_SETFONT, (WPARAM)DlgTermFont, MAKELPARAM(TRUE,0));
-				SendDlgItemMessage(Dialog, IDC_TERMIDLABEL, WM_SETFONT, (WPARAM)DlgTermFont, MAKELPARAM(TRUE,0));
-				SendDlgItemMessage(Dialog, IDC_TERMID, WM_SETFONT, (WPARAM)DlgTermFont, MAKELPARAM(TRUE,0));
-				SendDlgItemMessage(Dialog, IDC_TERMLOCALECHO, WM_SETFONT, (WPARAM)DlgTermFont, MAKELPARAM(TRUE,0));
-				SendDlgItemMessage(Dialog, IDC_TERMANSBACKTEXT, WM_SETFONT, (WPARAM)DlgTermFont, MAKELPARAM(TRUE,0));
-				SendDlgItemMessage(Dialog, IDC_TERMANSBACK, WM_SETFONT, (WPARAM)DlgTermFont, MAKELPARAM(TRUE,0));
-				SendDlgItemMessage(Dialog, IDC_TERMAUTOSWITCH, WM_SETFONT, (WPARAM)DlgTermFont, MAKELPARAM(TRUE,0));
-				SendDlgItemMessage(Dialog, IDOK, WM_SETFONT, (WPARAM)DlgTermFont, MAKELPARAM(TRUE,0));
-				SendDlgItemMessage(Dialog, IDCANCEL, WM_SETFONT, (WPARAM)DlgTermFont, MAKELPARAM(TRUE,0));
-				SendDlgItemMessage(Dialog, IDC_TERMHELP, WM_SETFONT, (WPARAM)DlgTermFont, MAKELPARAM(TRUE,0));
+			SetDlgTexts(Dialog, TextInfosCom, _countof(TextInfosCom), UILanguageFile);
 				if (ts->Language==IdJapanese) {
-					SendDlgItemMessage(Dialog, IDC_TERMKANJILABEL, WM_SETFONT, (WPARAM)DlgTermFont, MAKELPARAM(TRUE,0));
-					SendDlgItemMessage(Dialog, IDC_TERMKANJI, WM_SETFONT, (WPARAM)DlgTermFont, MAKELPARAM(TRUE,0));
-					SendDlgItemMessage(Dialog, IDC_TERMKANA, WM_SETFONT, (WPARAM)DlgTermFont, MAKELPARAM(TRUE,0));
-					SendDlgItemMessage(Dialog, IDC_TERMKANJISENDLABEL, WM_SETFONT, (WPARAM)DlgTermFont, MAKELPARAM(TRUE,0));
-					SendDlgItemMessage(Dialog, IDC_TERMKANJISEND, WM_SETFONT, (WPARAM)DlgTermFont, MAKELPARAM(TRUE,0));
-					SendDlgItemMessage(Dialog, IDC_TERMKANASEND, WM_SETFONT, (WPARAM)DlgTermFont, MAKELPARAM(TRUE,0));
-					SendDlgItemMessage(Dialog, IDC_TERMKINTEXT, WM_SETFONT, (WPARAM)DlgTermFont, MAKELPARAM(TRUE,0));
-					SendDlgItemMessage(Dialog, IDC_TERMKIN, WM_SETFONT, (WPARAM)DlgTermFont, MAKELPARAM(TRUE,0));
-					SendDlgItemMessage(Dialog, IDC_TERMKOUTTEXT, WM_SETFONT, (WPARAM)DlgTermFont, MAKELPARAM(TRUE,0));
-					SendDlgItemMessage(Dialog, IDC_TERMKOUT, WM_SETFONT, (WPARAM)DlgTermFont, MAKELPARAM(TRUE,0));
-					SendDlgItemMessage(Dialog, IDC_LOCALE_LABEL, WM_SETFONT, (WPARAM)DlgTermFont, MAKELPARAM(TRUE,0));
-					SendDlgItemMessage(Dialog, IDC_LOCALE_EDIT, WM_SETFONT, (WPARAM)DlgTermFont, MAKELPARAM(TRUE,0));
-				}
-				else if (ts->Language==IdRussian) {
-					SendDlgItemMessage(Dialog, IDC_TERMRUSSCHARSET, WM_SETFONT, (WPARAM)DlgTermFont, MAKELPARAM(TRUE,0));
-					SendDlgItemMessage(Dialog, IDC_TERMRUSSHOSTLABEL, WM_SETFONT, (WPARAM)DlgTermFont, MAKELPARAM(TRUE,0));
-					SendDlgItemMessage(Dialog, IDC_TERMRUSSHOST, WM_SETFONT, (WPARAM)DlgTermFont, MAKELPARAM(TRUE,0));
-					SendDlgItemMessage(Dialog, IDC_TERMRUSSCLIENTLABEL, WM_SETFONT, (WPARAM)DlgTermFont, MAKELPARAM(TRUE,0));
-					SendDlgItemMessage(Dialog, IDC_TERMRUSSCLIENT, WM_SETFONT, (WPARAM)DlgTermFont, MAKELPARAM(TRUE,0));
-					SendDlgItemMessage(Dialog, IDC_TERMRUSSFONTLABEL, WM_SETFONT, (WPARAM)DlgTermFont, MAKELPARAM(TRUE,0));
-					SendDlgItemMessage(Dialog, IDC_TERMRUSSFONT, WM_SETFONT, (WPARAM)DlgTermFont, MAKELPARAM(TRUE,0));
-				}
-				else if (ts->Language==IdUtf8 || ts->Language==IdKorean) {
-					SendDlgItemMessage(Dialog, IDC_TERMKANJILABEL, WM_SETFONT, (WPARAM)DlgTermFont, MAKELPARAM(TRUE,0));
-					SendDlgItemMessage(Dialog, IDC_TERMKANJI, WM_SETFONT, (WPARAM)DlgTermFont, MAKELPARAM(TRUE,0));
-					SendDlgItemMessage(Dialog, IDC_TERMKANJISENDLABEL, WM_SETFONT, (WPARAM)DlgTermFont, MAKELPARAM(TRUE,0));
-					SendDlgItemMessage(Dialog, IDC_TERMKANJISEND, WM_SETFONT, (WPARAM)DlgTermFont, MAKELPARAM(TRUE,0));
-					SendDlgItemMessage(Dialog, IDC_LOCALE_LABEL, WM_SETFONT, (WPARAM)DlgTermFont, MAKELPARAM(TRUE,0));
-					SendDlgItemMessage(Dialog, IDC_LOCALE_EDIT, WM_SETFONT, (WPARAM)DlgTermFont, MAKELPARAM(TRUE,0));
-				}
+				static const DlgTextInfo TextInfosJp[] = {
+					{ IDC_TERMKANJILABEL, "DLG_TERM_KANJI" },
+					{ IDC_TERMKANA, "DLG_TERM_KANA" },
+					{ IDC_TERMKANJISENDLABEL, "DLG_TERM_KANJISEND" },
+					{ IDC_TERMKANASEND, "DLG_TERM_KANASEND" },
+					{ IDC_TERMKINTEXT, "DLG_TERM_KIN" },
+					{ IDC_TERMKOUTTEXT, "DLG_TERM_KOUT" },
+					{ IDC_LOCALE_LABEL, "DLG_TERM_LOCALE" },
+				};
+				SetDlgTexts(Dialog, TextInfosJp, _countof(TextInfosJp), UILanguageFile);
 			}
-			else {
-				DlgTermFont = NULL;
-			}
-
-			GetWindowText(Dialog, uimsg2, sizeof(uimsg2));
-			get_lang_msg("DLG_TERM_TITLE", uimsg, sizeof(uimsg), uimsg2, UILanguageFile);
-			SetWindowText(Dialog, uimsg);
-			GetDlgItemText(Dialog, IDC_TERMWIDTHLABEL, uimsg2, sizeof(uimsg2));
-			get_lang_msg("DLG_TERM_WIDTHLABEL", uimsg, sizeof(uimsg), uimsg2, UILanguageFile);
-			SetDlgItemText(Dialog, IDC_TERMWIDTHLABEL, uimsg);
-			GetDlgItemText(Dialog, IDC_TERMISWIN, uimsg2, sizeof(uimsg2));
-			get_lang_msg("DLG_TERM_ISWIN", uimsg, sizeof(uimsg), uimsg2, UILanguageFile);
-			SetDlgItemText(Dialog, IDC_TERMISWIN, uimsg);
-			GetDlgItemText(Dialog, IDC_TERMRESIZE, uimsg2, sizeof(uimsg2));
-			get_lang_msg("DLG_TERM_RESIZE", uimsg, sizeof(uimsg), uimsg2, UILanguageFile);
-			SetDlgItemText(Dialog, IDC_TERMRESIZE, uimsg);
-			GetDlgItemText(Dialog, IDC_TERMNEWLINE, uimsg2, sizeof(uimsg2));
-			get_lang_msg("DLG_TERM_NEWLINE", uimsg, sizeof(uimsg), uimsg2, UILanguageFile);
-			SetDlgItemText(Dialog, IDC_TERMNEWLINE, uimsg);
-			GetDlgItemText(Dialog, IDC_TERMCRRCVLABEL, uimsg2, sizeof(uimsg2));
-			get_lang_msg("DLG_TERM_CRRCV", uimsg, sizeof(uimsg), uimsg2, UILanguageFile);
-			SetDlgItemText(Dialog, IDC_TERMCRRCVLABEL, uimsg);
-			GetDlgItemText(Dialog, IDC_TERMCRSENDLABEL, uimsg2, sizeof(uimsg2));
-			get_lang_msg("DLG_TERM_CRSEND", uimsg, sizeof(uimsg), uimsg2, UILanguageFile);
-			SetDlgItemText(Dialog, IDC_TERMCRSENDLABEL, uimsg);
-			GetDlgItemText(Dialog, IDC_TERMIDLABEL, uimsg2, sizeof(uimsg2));
-			get_lang_msg("DLG_TERM_ID", uimsg, sizeof(uimsg), uimsg2, UILanguageFile);
-			SetDlgItemText(Dialog, IDC_TERMIDLABEL, uimsg);
-			GetDlgItemText(Dialog, IDC_TERMLOCALECHO, uimsg2, sizeof(uimsg2));
-			get_lang_msg("DLG_TERM_LOCALECHO", uimsg, sizeof(uimsg), uimsg2, UILanguageFile);
-			SetDlgItemText(Dialog, IDC_TERMLOCALECHO, uimsg);
-			GetDlgItemText(Dialog, IDC_TERMANSBACKTEXT, uimsg2, sizeof(uimsg2));
-			get_lang_msg("DLG_TERM_ANSBACK", uimsg, sizeof(uimsg), uimsg2, UILanguageFile);
-			SetDlgItemText(Dialog, IDC_TERMANSBACKTEXT, uimsg);
-			GetDlgItemText(Dialog, IDC_TERMAUTOSWITCH, uimsg2, sizeof(uimsg2));
-			get_lang_msg("DLG_TERM_AUTOSWITCH", uimsg, sizeof(uimsg), uimsg2, UILanguageFile);
-			SetDlgItemText(Dialog, IDC_TERMAUTOSWITCH, uimsg);
-			GetDlgItemText(Dialog, IDOK, uimsg2, sizeof(uimsg2));
-			get_lang_msg("BTN_OK", uimsg, sizeof(uimsg), uimsg2, UILanguageFile);
-			SetDlgItemText(Dialog, IDOK, uimsg);
-			GetDlgItemText(Dialog, IDCANCEL, uimsg2, sizeof(uimsg2));
-			get_lang_msg("BTN_CANCEL", uimsg, sizeof(uimsg), uimsg2, UILanguageFile);
-			SetDlgItemText(Dialog, IDCANCEL, uimsg);
-			GetDlgItemText(Dialog, IDC_TERMHELP, uimsg2, sizeof(uimsg2));
-			get_lang_msg("BTN_HELP", uimsg, sizeof(uimsg), uimsg2, UILanguageFile);
-			SetDlgItemText(Dialog, IDC_TERMHELP, uimsg);
-			if ( ts->Language==IdJapanese ) {
-				GetDlgItemText(Dialog, IDC_TERMKANJILABEL, uimsg2, sizeof(uimsg2));
-				get_lang_msg("DLG_TERM_KANJI", uimsg, sizeof(uimsg), uimsg2, UILanguageFile);
-				SetDlgItemText(Dialog, IDC_TERMKANJILABEL, uimsg);
-				GetDlgItemText(Dialog, IDC_TERMKANA, uimsg2, sizeof(uimsg2));
-				get_lang_msg("DLG_TERM_KANA", uimsg, sizeof(uimsg), uimsg2, UILanguageFile);
-				SetDlgItemText(Dialog, IDC_TERMKANA, uimsg);
-				GetDlgItemText(Dialog, IDC_TERMKANJISENDLABEL, uimsg2, sizeof(uimsg2));
-				get_lang_msg("DLG_TERM_KANJISEND", uimsg, sizeof(uimsg), uimsg2, UILanguageFile);
-				SetDlgItemText(Dialog, IDC_TERMKANJISENDLABEL, uimsg);
-				GetDlgItemText(Dialog, IDC_TERMKANASEND, uimsg2, sizeof(uimsg2));
-				get_lang_msg("DLG_TERM_KANASEND", uimsg, sizeof(uimsg), uimsg2, UILanguageFile);
-				SetDlgItemText(Dialog, IDC_TERMKANASEND, uimsg);
-				GetDlgItemText(Dialog, IDC_TERMKINTEXT, uimsg2, sizeof(uimsg2));
-				get_lang_msg("DLG_TERM_KIN", uimsg, sizeof(uimsg), uimsg2, UILanguageFile);
-				SetDlgItemText(Dialog, IDC_TERMKINTEXT, uimsg);
-				GetDlgItemText(Dialog, IDC_TERMKOUTTEXT, uimsg2, sizeof(uimsg2));
-				get_lang_msg("DLG_TERM_KOUT", uimsg, sizeof(uimsg), uimsg2, UILanguageFile);
-				SetDlgItemText(Dialog, IDC_TERMKOUTTEXT, uimsg);
-				GetDlgItemText(Dialog, IDC_LOCALE_LABEL, uimsg2, sizeof(uimsg2));
-				get_lang_msg("DLG_TERM_LOCALE", uimsg, sizeof(uimsg), uimsg2, UILanguageFile);
-				SetDlgItemText(Dialog, IDC_LOCALE_LABEL, uimsg);
-			}
 			else if ( ts->Language==IdRussian ) {
-				GetDlgItemText(Dialog, IDC_TERMRUSSCHARSET, uimsg2, sizeof(uimsg2));
-				get_lang_msg("DLG_TERM_RUSSCHARSET", uimsg, sizeof(uimsg), uimsg2, UILanguageFile);
-				SetDlgItemText(Dialog, IDC_TERMRUSSCHARSET, uimsg);
-				GetDlgItemText(Dialog, IDC_TERMRUSSHOSTLABEL, uimsg2, sizeof(uimsg2));
-				get_lang_msg("DLG_TERM_RUSSHOST", uimsg, sizeof(uimsg), uimsg2, UILanguageFile);
-				SetDlgItemText(Dialog, IDC_TERMRUSSHOSTLABEL, uimsg);
-				GetDlgItemText(Dialog, IDC_TERMRUSSCLIENTLABEL, uimsg2, sizeof(uimsg2));
-				get_lang_msg("DLG_TERM_RUSSCLIENT", uimsg, sizeof(uimsg), uimsg2, UILanguageFile);
-				SetDlgItemText(Dialog, IDC_TERMRUSSCLIENTLABEL, uimsg);
-				GetDlgItemText(Dialog, IDC_TERMRUSSFONTLABEL, uimsg2, sizeof(uimsg2));
-				get_lang_msg("DLG_TERM_RUSSFONT", uimsg, sizeof(uimsg), uimsg2, UILanguageFile);
-				SetDlgItemText(Dialog, IDC_TERMRUSSFONTLABEL, uimsg);
+				static const DlgTextInfo TextInfosRu[] = {
+					{ IDC_TERMRUSSCHARSET, "DLG_TERM_RUSSCHARSET" },
+					{ IDC_TERMRUSSHOSTLABEL, "DLG_TERM_RUSSHOST" },
+					{ IDC_TERMRUSSCLIENTLABEL, "DLG_TERM_RUSSCLIENT" },
+					{ IDC_TERMRUSSFONTLABEL, "DLG_TERM_RUSSFONT" },
+				};
+				SetDlgTexts(Dialog, TextInfosRu, _countof(TextInfosRu), UILanguageFile);
 			}
 			else if (ts->Language==IdUtf8 || ts->Language==IdKorean) {
-				GetDlgItemText(Dialog, IDC_TERMKANJILABEL, uimsg2, sizeof(uimsg2));
-				get_lang_msg("DLG_TERMK_KANJI", uimsg, sizeof(uimsg), uimsg2, UILanguageFile);
-				SetDlgItemText(Dialog, IDC_TERMKANJILABEL, uimsg);
-				GetDlgItemText(Dialog, IDC_TERMKANJISENDLABEL, uimsg2, sizeof(uimsg2));
-				get_lang_msg("DLG_TERMK_KANJISEND", uimsg, sizeof(uimsg), uimsg2, UILanguageFile);
-				SetDlgItemText(Dialog, IDC_TERMKANJISENDLABEL, uimsg);
-				GetDlgItemText(Dialog, IDC_LOCALE_LABEL, uimsg2, sizeof(uimsg2));
-				get_lang_msg("DLG_TERM_LOCALE", uimsg, sizeof(uimsg), uimsg2, UILanguageFile);
-				SetDlgItemText(Dialog, IDC_LOCALE_LABEL, uimsg);
+				static const DlgTextInfo TextInfosKo[] = {
+					{ IDC_TERMKANJILABEL, "DLG_TERMK_KANJI" },
+					{ IDC_TERMKANJISENDLABEL, "DLG_TERMK_KANJISEND" },
+					{ IDC_LOCALE_LABEL, "DLG_TERM_LOCALE" },
+				};
+				SetDlgTexts(Dialog, TextInfosKo, _countof(TextInfosKo), UILanguageFile);
 			}
 
 			SetDlgItemInt(Dialog,IDC_TERMWIDTH,ts->TerminalWidth,FALSE);
@@ -475,16 +370,10 @@
 
 					}
 					EndDialog(Dialog, 1);
-					if (DlgTermFont != NULL) {
-						DeleteObject(DlgTermFont);
-					}
 					return TRUE;
 
 				case IDCANCEL:
 					EndDialog(Dialog, 0);
-					if (DlgTermFont != NULL) {
-						DeleteObject(DlgTermFont);
-					}
 					return TRUE;
 
 				case IDC_TERMISWIN:
@@ -611,141 +500,51 @@
 	}
 }
 
-BOOL CALLBACK WinDlg(HWND Dialog, UINT Message, WPARAM wParam, LPARAM lParam)
+static INT_PTR CALLBACK WinDlg(HWND Dialog, UINT Message, WPARAM wParam, LPARAM lParam)
 {
+	static const DlgTextInfo TextInfos[] = {
+		{ 0, "DLG_WIN_TITLE" },
+		{ IDC_WINTITLELABEL, "DLG_WIN_TITLELABEL" },
+		{ IDC_WINCURSOR, "DLG_WIN_CURSOR" },
+		{ IDC_WINBLOCK, "DLG_WIN_BLOCK" },
+		{ IDC_WINVERT, "DLG_WIN_VERT" },
+		{ IDC_WINHORZ, "DLG_WIN_HORZ" },
+		{ IDC_FONTBOLD, "DLG_WIN_BOLDFONT" },
+		{ IDC_WINHIDETITLE, "DLG_WIN_HIDETITLE" },
+		{ IDC_WINHIDEMENU, "DLG_WIN_HIDEMENU" },
+		{ IDC_WINCOLOREMU, "DLG_WIN_COLOREMU" },
+		{ IDC_WINAIXTERM16, "DLG_WIN_AIXTERM16" },
+		{ IDC_WINXTERM256, "DLG_WIN_XTERM256" },
+		{ IDC_WINSCROLL1, "DLG_WIN_SCROLL1" },
+		{ IDC_WINSCROLL3, "DLG_WIN_SCROLL3" },
+		{ IDC_WINCOLOR, "DLG_WIN_COLOR" },
+		{ IDC_WINTEXT, "DLG_WIN_TEXT" },
+		{ IDC_WINBACK, "DLG_WIN_BG" },
+		{ IDC_WINATTRTEXT, "DLG_WIN_ATTRIB" },
+		{ IDC_WINREV, "DLG_WIN_REVERSE" },
+		{ IDC_WINREDLABEL, "DLG_WIN_R" },
+		{ IDC_WINGREENLABEL, "DLG_WIN_G" },
+		{ IDC_WINBLUELABEL, "DLG_WIN_B" },
+		{ IDC_WINUSENORMALBG, "DLG_WIN_ALWAYSBG" },
+		{ IDOK, "BTN_OK" },
+		{ IDCANCEL, "BTN_CANCEL" },
+		{ IDC_WINHELP, "BTN_HELP" },
+		{ IDC_WINCOLOREMU, "DLG_WIN_PCBOLD16" },		// get_lang_msg
+	};
 	PTTSet ts;
 	HWND Wnd, HRed, HGreen, HBlue;
 	int IAttr, IOffset;
 	WORD i, pos, ScrollCode, NewPos;
 	HDC DC;
-	char uimsg[MAX_UIMSG], uimsg2[MAX_UIMSG];
-	LOGFONT logfont;
-	HFONT font;
+	TCHAR uimsg[MAX_UIMSG];
 
 	switch (Message) {
 		case WM_INITDIALOG:
 			ts = (PTTSet)lParam;
-			SetWindowLong(Dialog, DWL_USER, lParam);
+			SetWindowLongPtr(Dialog, DWLP_USER, lParam);
 
-			font = (HFONT)SendMessage(Dialog, WM_GETFONT, 0, 0);
-			GetObject(font, sizeof(LOGFONT), &logfont);
-			if (get_lang_font("DLG_SYSTEM_FONT", Dialog, &logfont, &DlgWinFont, UILanguageFile)) {
-				SendDlgItemMessage(Dialog, IDC_WINTITLELABEL, WM_SETFONT, (WPARAM)DlgWinFont, MAKELPARAM(TRUE,0));
-				SendDlgItemMessage(Dialog, IDC_WINTITLE, WM_SETFONT, (WPARAM)DlgWinFont, MAKELPARAM(TRUE,0));
-				SendDlgItemMessage(Dialog, IDC_WINCURSOR, WM_SETFONT, (WPARAM)DlgWinFont, MAKELPARAM(TRUE,0));
-				SendDlgItemMessage(Dialog, IDC_WINBLOCK, WM_SETFONT, (WPARAM)DlgWinFont, MAKELPARAM(TRUE,0));
-				SendDlgItemMessage(Dialog, IDC_WINVERT, WM_SETFONT, (WPARAM)DlgWinFont, MAKELPARAM(TRUE,0));
-				SendDlgItemMessage(Dialog, IDC_WINHORZ, WM_SETFONT, (WPARAM)DlgWinFont, MAKELPARAM(TRUE,0));
-				SendDlgItemMessage(Dialog, IDC_FONTBOLD, WM_SETFONT, (WPARAM)DlgWinFont, MAKELPARAM(TRUE,0));
-				SendDlgItemMessage(Dialog, IDC_WINHIDETITLE, WM_SETFONT, (WPARAM)DlgWinFont, MAKELPARAM(TRUE,0));
-				SendDlgItemMessage(Dialog, IDC_WINHIDEMENU, WM_SETFONT, (WPARAM)DlgWinFont, MAKELPARAM(TRUE,0));
-				SendDlgItemMessage(Dialog, IDC_WINCOLOREMU, WM_SETFONT, (WPARAM)DlgWinFont, MAKELPARAM(TRUE,0));
-				SendDlgItemMessage(Dialog, IDC_WINAIXTERM16, WM_SETFONT, (WPARAM)DlgWinFont, MAKELPARAM(TRUE,0));
-				SendDlgItemMessage(Dialog, IDC_WINXTERM256, WM_SETFONT, (WPARAM)DlgWinFont, MAKELPARAM(TRUE,0));
-				SendDlgItemMessage(Dialog, IDC_WINSCROLL1, WM_SETFONT, (WPARAM)DlgWinFont, MAKELPARAM(TRUE,0));
-				SendDlgItemMessage(Dialog, IDC_WINSCROLL3, WM_SETFONT, (WPARAM)DlgWinFont, MAKELPARAM(TRUE,0));
-				SendDlgItemMessage(Dialog, IDC_WINSCROLL2, WM_SETFONT, (WPARAM)DlgWinFont, MAKELPARAM(TRUE,0));
-				SendDlgItemMessage(Dialog, IDC_WINCOLOR, WM_SETFONT, (WPARAM)DlgWinFont, MAKELPARAM(TRUE,0));
-				SendDlgItemMessage(Dialog, IDC_WINTEXT, WM_SETFONT, (WPARAM)DlgWinFont, MAKELPARAM(TRUE,0));
-				SendDlgItemMessage(Dialog, IDC_WINBACK, WM_SETFONT, (WPARAM)DlgWinFont, MAKELPARAM(TRUE,0));
-				SendDlgItemMessage(Dialog, IDC_WINREV, WM_SETFONT, (WPARAM)DlgWinFont, MAKELPARAM(TRUE,0));
-				SendDlgItemMessage(Dialog, IDC_WINATTRTEXT, WM_SETFONT, (WPARAM)DlgWinFont, MAKELPARAM(TRUE,0));
-				SendDlgItemMessage(Dialog, IDC_WINATTR, WM_SETFONT, (WPARAM)DlgWinFont, MAKELPARAM(TRUE,0));
-				SendDlgItemMessage(Dialog, IDC_WINREDLABEL, WM_SETFONT, (WPARAM)DlgWinFont, MAKELPARAM(TRUE,0));
-				SendDlgItemMessage(Dialog, IDC_WINRED, WM_SETFONT, (WPARAM)DlgWinFont, MAKELPARAM(TRUE,0));
-				SendDlgItemMessage(Dialog, IDC_WINGREENLABEL, WM_SETFONT, (WPARAM)DlgWinFont, MAKELPARAM(TRUE,0));
-				SendDlgItemMessage(Dialog, IDC_WINGREEN, WM_SETFONT, (WPARAM)DlgWinFont, MAKELPARAM(TRUE,0));
-				SendDlgItemMessage(Dialog, IDC_WINBLUELABEL, WM_SETFONT, (WPARAM)DlgWinFont, MAKELPARAM(TRUE,0));
-				SendDlgItemMessage(Dialog, IDC_WINBLUE, WM_SETFONT, (WPARAM)DlgWinFont, MAKELPARAM(TRUE,0));
-				SendDlgItemMessage(Dialog, IDC_WINUSENORMALBG, WM_SETFONT, (WPARAM)DlgWinFont, MAKELPARAM(TRUE,0));
-				SendDlgItemMessage(Dialog, IDOK, WM_SETFONT, (WPARAM)DlgWinFont, MAKELPARAM(TRUE,0));
-				SendDlgItemMessage(Dialog, IDCANCEL, WM_SETFONT, (WPARAM)DlgWinFont, MAKELPARAM(TRUE,0));
-				SendDlgItemMessage(Dialog, IDC_WINHELP, WM_SETFONT, (WPARAM)DlgWinFont, MAKELPARAM(TRUE,0));
-			}
-			else {
-				DlgWinFont = NULL;
-			}
-
-			GetWindowText(Dialog, uimsg2, sizeof(uimsg2));
-			get_lang_msg("DLG_WIN_TITLE", uimsg, sizeof(uimsg), uimsg2, UILanguageFile);
-			SetWindowText(Dialog, uimsg);
-			GetDlgItemText(Dialog, IDC_WINTITLELABEL, uimsg2, sizeof(uimsg2));
-			get_lang_msg("DLG_WIN_TITLELABEL", uimsg, sizeof(uimsg), uimsg2, UILanguageFile);
-			SetDlgItemText(Dialog, IDC_WINTITLELABEL, uimsg);
-			GetDlgItemText(Dialog, IDC_WINCURSOR, uimsg2, sizeof(uimsg2));
-			get_lang_msg("DLG_WIN_CURSOR", uimsg, sizeof(uimsg), uimsg2, UILanguageFile);
-			SetDlgItemText(Dialog, IDC_WINCURSOR, uimsg);
-			GetDlgItemText(Dialog, IDC_WINBLOCK, uimsg2, sizeof(uimsg2));
-			get_lang_msg("DLG_WIN_BLOCK", uimsg, sizeof(uimsg), uimsg2, UILanguageFile);
-			SetDlgItemText(Dialog, IDC_WINBLOCK, uimsg);
-			GetDlgItemText(Dialog, IDC_WINVERT, uimsg2, sizeof(uimsg2));
-			get_lang_msg("DLG_WIN_VERT", uimsg, sizeof(uimsg), uimsg2, UILanguageFile);
-			SetDlgItemText(Dialog, IDC_WINVERT, uimsg);
-			GetDlgItemText(Dialog, IDC_WINHORZ, uimsg2, sizeof(uimsg2));
-			get_lang_msg("DLG_WIN_HORZ", uimsg, sizeof(uimsg), uimsg2, UILanguageFile);
-			SetDlgItemText(Dialog, IDC_WINHORZ, uimsg);
-			GetDlgItemText(Dialog, IDC_FONTBOLD, uimsg2, sizeof(uimsg2));
-			get_lang_msg("DLG_WIN_BOLDFONT", uimsg, sizeof(uimsg), uimsg2, UILanguageFile);
-			SetDlgItemText(Dialog, IDC_FONTBOLD, uimsg);
-			GetDlgItemText(Dialog, IDC_WINHIDETITLE, uimsg2, sizeof(uimsg2));
-			get_lang_msg("DLG_WIN_HIDETITLE", uimsg, sizeof(uimsg), uimsg2, UILanguageFile);
-			SetDlgItemText(Dialog, IDC_WINHIDETITLE, uimsg);
-			GetDlgItemText(Dialog, IDC_WINHIDEMENU, uimsg2, sizeof(uimsg2));
-			get_lang_msg("DLG_WIN_HIDEMENU", uimsg, sizeof(uimsg), uimsg2, UILanguageFile);
-			SetDlgItemText(Dialog, IDC_WINHIDEMENU, uimsg);
-			GetDlgItemText(Dialog, IDC_WINCOLOREMU, uimsg2, sizeof(uimsg2));
-			get_lang_msg("DLG_WIN_COLOREMU", uimsg, sizeof(uimsg), uimsg2, UILanguageFile);
-			SetDlgItemText(Dialog, IDC_WINCOLOREMU, uimsg);
-			GetDlgItemText(Dialog, IDC_WINAIXTERM16, uimsg2, sizeof(uimsg2));
-			get_lang_msg("DLG_WIN_AIXTERM16", uimsg, sizeof(uimsg), uimsg2, UILanguageFile);
-			SetDlgItemText(Dialog, IDC_WINAIXTERM16, uimsg);
-			GetDlgItemText(Dialog, IDC_WINXTERM256, uimsg2, sizeof(uimsg2));
-			get_lang_msg("DLG_WIN_XTERM256", uimsg, sizeof(uimsg), uimsg2, UILanguageFile);
-			SetDlgItemText(Dialog, IDC_WINXTERM256, uimsg);
-			GetDlgItemText(Dialog, IDC_WINSCROLL1, uimsg2, sizeof(uimsg2));
-			get_lang_msg("DLG_WIN_SCROLL1", uimsg, sizeof(uimsg), uimsg2, UILanguageFile);
-			SetDlgItemText(Dialog, IDC_WINSCROLL1, uimsg);
-			GetDlgItemText(Dialog, IDC_WINSCROLL3, uimsg2, sizeof(uimsg2));
-			get_lang_msg("DLG_WIN_SCROLL3", uimsg, sizeof(uimsg), uimsg2, UILanguageFile);
-			SetDlgItemText(Dialog, IDC_WINSCROLL3, uimsg);
-			GetDlgItemText(Dialog, IDC_WINCOLOR, uimsg2, sizeof(uimsg2));
-			get_lang_msg("DLG_WIN_COLOR", uimsg, sizeof(uimsg), uimsg2, UILanguageFile);
-			SetDlgItemText(Dialog, IDC_WINCOLOR, uimsg);
-			GetDlgItemText(Dialog, IDC_WINTEXT, uimsg2, sizeof(uimsg2));
-			get_lang_msg("DLG_WIN_TEXT", uimsg, sizeof(uimsg), uimsg2, UILanguageFile);
-			SetDlgItemText(Dialog, IDC_WINTEXT, uimsg);
-			GetDlgItemText(Dialog, IDC_WINBACK, uimsg2, sizeof(uimsg2));
-			get_lang_msg("DLG_WIN_BG", uimsg, sizeof(uimsg), uimsg2, UILanguageFile);
-			SetDlgItemText(Dialog, IDC_WINBACK, uimsg);
-			GetDlgItemText(Dialog, IDC_WINATTRTEXT, uimsg2, sizeof(uimsg2));
-			get_lang_msg("DLG_WIN_ATTRIB", uimsg, sizeof(uimsg), uimsg2, UILanguageFile);
-			SetDlgItemText(Dialog, IDC_WINATTRTEXT, uimsg);
-			GetDlgItemText(Dialog, IDC_WINREV, uimsg2, sizeof(uimsg2));
-			get_lang_msg("DLG_WIN_REVERSE", uimsg, sizeof(uimsg), uimsg2, UILanguageFile);
-			SetDlgItemText(Dialog, IDC_WINREV, uimsg);
-			GetDlgItemText(Dialog, IDC_WINREDLABEL, uimsg2, sizeof(uimsg2));
-			get_lang_msg("DLG_WIN_R", uimsg, sizeof(uimsg), uimsg2, UILanguageFile);
-			SetDlgItemText(Dialog, IDC_WINREDLABEL, uimsg);
-			GetDlgItemText(Dialog, IDC_WINGREENLABEL, uimsg2, sizeof(uimsg2));
-			get_lang_msg("DLG_WIN_G", uimsg, sizeof(uimsg), uimsg2, UILanguageFile);
-			SetDlgItemText(Dialog, IDC_WINGREENLABEL, uimsg);
-			GetDlgItemText(Dialog, IDC_WINBLUELABEL, uimsg2, sizeof(uimsg2));
-			get_lang_msg("DLG_WIN_B", uimsg, sizeof(uimsg), uimsg2, UILanguageFile);
-			SetDlgItemText(Dialog, IDC_WINBLUELABEL, uimsg);
-			GetDlgItemText(Dialog, IDC_WINUSENORMALBG, uimsg2, sizeof(uimsg2));
-			get_lang_msg("DLG_WIN_ALWAYSBG", uimsg, sizeof(uimsg), uimsg2, UILanguageFile);
-			SetDlgItemText(Dialog, IDC_WINUSENORMALBG, uimsg);
-			GetDlgItemText(Dialog, IDOK, uimsg2, sizeof(uimsg2));
-			get_lang_msg("BTN_OK", uimsg, sizeof(uimsg), uimsg2, UILanguageFile);
-			SetDlgItemText(Dialog, IDOK, uimsg);
-			GetDlgItemText(Dialog, IDCANCEL, uimsg2, sizeof(uimsg2));
-			get_lang_msg("BTN_CANCEL", uimsg, sizeof(uimsg), uimsg2, UILanguageFile);
-			SetDlgItemText(Dialog, IDCANCEL, uimsg);
-			GetDlgItemText(Dialog, IDC_WINHELP, uimsg2, sizeof(uimsg2));
-			get_lang_msg("BTN_HELP", uimsg, sizeof(uimsg), uimsg2, UILanguageFile);
-			SetDlgItemText(Dialog, IDC_WINHELP, uimsg);
-
-			SetDlgItemText(Dialog, IDC_WINTITLE, ts->Title);
+			SetDlgTexts(Dialog, TextInfos, _countof(TextInfos), UILanguageFile);
+			SetDlgItemTextA(Dialog, IDC_WINTITLE, ts->Title);
 			SendDlgItemMessage(Dialog, IDC_WINTITLE, EM_LIMITTEXT,
 			                   sizeof(ts->Title)-1, 0);
 
@@ -1057,16 +856,10 @@
 						GetRB(Dialog,&ts->CursorShape,IDC_WINBLOCK,IDC_WINHORZ);
 					}
 					EndDialog(Dialog, 1);
-					if (DlgWinFont != NULL) {
-						DeleteObject(DlgWinFont);
-					}
 					return TRUE;
 
 				case IDCANCEL:
 					EndDialog(Dialog, 0);
-					if (DlgWinFont != NULL) {
-						DeleteObject(DlgWinFont);
-					}
 					return TRUE;
 
 				case IDC_WINHIDETITLE:
@@ -1219,76 +1012,31 @@
 	return FALSE;
 }
 
-BOOL CALLBACK KeybDlg(HWND Dialog, UINT Message, WPARAM wParam, LPARAM lParam)
+static INT_PTR CALLBACK KeybDlg(HWND Dialog, UINT Message, WPARAM wParam, LPARAM lParam)
 {
+	static const DlgTextInfo TextInfos[] = {
+		{ 0, "DLG_KEYB_TITLE" },
+		{ IDC_KEYBTRANS, "DLG_KEYB_TRANSMIT" },
+		{ IDC_KEYBBS, "DLG_KEYB_BS" },
+		{ IDC_KEYBDEL, "DLG_KEYB_DEL" },
+		{ IDC_KEYBKEYBTEXT, "DLG_KEYB_KEYB" },
+		{ IDC_KEYBMETATEXT, "DLG_KEYB_META" },
+		{ IDC_KEYBDISABLE, "DLG_KEYB_DISABLE" },
+		{ IDC_KEYBAPPKEY, "DLG_KEYB_APPKEY" },
+		{ IDC_KEYBAPPCUR, "DLG_KEYB_APPCUR" },
+		{ IDOK, "BTN_OK" },
+		{ IDCANCEL, "BTN_CANCEL" },
+		{ IDC_KEYBHELP, "BTN_HELP" },
+	};
 	PTTSet ts;
-	char uimsg[MAX_UIMSG], uimsg2[MAX_UIMSG];
-	LOGFONT logfont;
-	HFONT font;
 
 	switch (Message) {
 		case WM_INITDIALOG:
 			ts = (PTTSet)lParam;
-			SetWindowLong(Dialog, DWL_USER, lParam);
+			SetWindowLongPtr(Dialog, DWLP_USER, lParam);
 
-			font = (HFONT)SendMessage(Dialog, WM_GETFONT, 0, 0);
-			GetObject(font, sizeof(LOGFONT), &logfont);
-			if (get_lang_font("DLG_SYSTEM_FONT", Dialog, &logfont, &DlgKeybFont, UILanguageFile)) {
-				SendDlgItemMessage(Dialog, IDC_KEYBTRANS, WM_SETFONT, (WPARAM)DlgKeybFont, MAKELPARAM(TRUE,0));
-				SendDlgItemMessage(Dialog, IDC_KEYBBS, WM_SETFONT, (WPARAM)DlgKeybFont, MAKELPARAM(TRUE,0));
-				SendDlgItemMessage(Dialog, IDC_KEYBDEL, WM_SETFONT, (WPARAM)DlgKeybFont, MAKELPARAM(TRUE,0));
-				SendDlgItemMessage(Dialog, IDC_KEYBKEYBTEXT, WM_SETFONT, (WPARAM)DlgKeybFont, MAKELPARAM(TRUE,0));
-				SendDlgItemMessage(Dialog, IDC_KEYBKEYB, WM_SETFONT, (WPARAM)DlgKeybFont, MAKELPARAM(TRUE,0));
-				SendDlgItemMessage(Dialog, IDC_KEYBMETATEXT, WM_SETFONT, (WPARAM)DlgKeybFont, MAKELPARAM(TRUE,0));
-				SendDlgItemMessage(Dialog, IDC_KEYBMETA, WM_SETFONT, (WPARAM)DlgKeybFont, MAKELPARAM(TRUE,0));
-				SendDlgItemMessage(Dialog, IDC_KEYBDISABLE, WM_SETFONT, (WPARAM)DlgKeybFont, MAKELPARAM(TRUE,0));
-				SendDlgItemMessage(Dialog, IDC_KEYBAPPKEY, WM_SETFONT, (WPARAM)DlgKeybFont, MAKELPARAM(TRUE,0));
-				SendDlgItemMessage(Dialog, IDC_KEYBAPPCUR, WM_SETFONT, (WPARAM)DlgKeybFont, MAKELPARAM(TRUE,0));
-				SendDlgItemMessage(Dialog, IDOK, WM_SETFONT, (WPARAM)DlgKeybFont, MAKELPARAM(TRUE,0));
-				SendDlgItemMessage(Dialog, IDCANCEL, WM_SETFONT, (WPARAM)DlgKeybFont, MAKELPARAM(TRUE,0));
-				SendDlgItemMessage(Dialog, IDC_KEYBHELP, WM_SETFONT, (WPARAM)DlgKeybFont, MAKELPARAM(TRUE,0));
-			}
-			else {
-				DlgKeybFont = NULL;
-			}
+			SetDlgTexts(Dialog, TextInfos, _countof(TextInfos), UILanguageFile);
 
-			GetWindowText(Dialog, uimsg2, sizeof(uimsg2));
-			get_lang_msg("DLG_KEYB_TITLE", uimsg, sizeof(uimsg), uimsg2, UILanguageFile);
-			SetWindowText(Dialog, uimsg);
-			GetDlgItemText(Dialog, IDC_KEYBTRANS, uimsg2, sizeof(uimsg2));
-			get_lang_msg("DLG_KEYB_TRANSMIT", uimsg, sizeof(uimsg), uimsg2, UILanguageFile);
-			SetDlgItemText(Dialog, IDC_KEYBTRANS, uimsg);
-			GetDlgItemText(Dialog, IDC_KEYBBS, uimsg2, sizeof(uimsg2));
-			get_lang_msg("DLG_KEYB_BS", uimsg, sizeof(uimsg), uimsg2, UILanguageFile);
-			SetDlgItemText(Dialog, IDC_KEYBBS, uimsg);
-			GetDlgItemText(Dialog, IDC_KEYBDEL, uimsg2, sizeof(uimsg2));
-			get_lang_msg("DLG_KEYB_DEL", uimsg, sizeof(uimsg), uimsg2, UILanguageFile);
-			SetDlgItemText(Dialog, IDC_KEYBDEL, uimsg);
-			GetDlgItemText(Dialog, IDC_KEYBKEYBTEXT, uimsg2, sizeof(uimsg2));
-			get_lang_msg("DLG_KEYB_KEYB", uimsg, sizeof(uimsg), uimsg2, UILanguageFile);
-			SetDlgItemText(Dialog, IDC_KEYBKEYBTEXT, uimsg);
-			GetDlgItemText(Dialog, IDC_KEYBMETATEXT, uimsg2, sizeof(uimsg2));
-			get_lang_msg("DLG_KEYB_META", uimsg, sizeof(uimsg), uimsg2, UILanguageFile);
-			SetDlgItemText(Dialog, IDC_KEYBMETATEXT, uimsg);
-			GetDlgItemText(Dialog, IDC_KEYBDISABLE, uimsg2, sizeof(uimsg2));
-			get_lang_msg("DLG_KEYB_DISABLE", uimsg, sizeof(uimsg), uimsg2, UILanguageFile);
-			SetDlgItemText(Dialog, IDC_KEYBDISABLE, uimsg);
-			GetDlgItemText(Dialog, IDC_KEYBAPPKEY, uimsg2, sizeof(uimsg2));
-			get_lang_msg("DLG_KEYB_APPKEY", uimsg, sizeof(uimsg), uimsg2, UILanguageFile);
-			SetDlgItemText(Dialog, IDC_KEYBAPPKEY, uimsg);
-			GetDlgItemText(Dialog, IDC_KEYBAPPCUR, uimsg2, sizeof(uimsg2));
-			get_lang_msg("DLG_KEYB_APPCUR", uimsg, sizeof(uimsg), uimsg2, UILanguageFile);
-			SetDlgItemText(Dialog, IDC_KEYBAPPCUR, uimsg);
-			GetDlgItemText(Dialog, IDOK, uimsg2, sizeof(uimsg2));
-			get_lang_msg("BTN_OK", uimsg, sizeof(uimsg), uimsg2, UILanguageFile);
-			SetDlgItemText(Dialog, IDOK, uimsg);
-			GetDlgItemText(Dialog, IDCANCEL, uimsg2, sizeof(uimsg2));
-			get_lang_msg("BTN_CANCEL", uimsg, sizeof(uimsg), uimsg2, UILanguageFile);
-			SetDlgItemText(Dialog, IDCANCEL, uimsg);
-			GetDlgItemText(Dialog, IDC_KEYBHELP, uimsg2, sizeof(uimsg2));
-			get_lang_msg("BTN_HELP", uimsg, sizeof(uimsg), uimsg2, UILanguageFile);
-			SetDlgItemText(Dialog, IDC_KEYBHELP, uimsg);
-
 			SetRB(Dialog,ts->BSKey-1,IDC_KEYBBS,IDC_KEYBBS);
 			SetRB(Dialog,ts->DelKey,IDC_KEYBDEL,IDC_KEYBDEL);
 			SetRB(Dialog,ts->MetaKey,IDC_KEYBMETA,IDC_KEYBMETA);
@@ -1311,7 +1059,7 @@
 		case WM_COMMAND:
 			switch (LOWORD(wParam)) {
 				case IDOK:
-					ts = (PTTSet)GetWindowLong(Dialog,DWL_USER);
+					ts = (PTTSet)GetWindowLongPtr(Dialog,DWLP_USER);
 					if ( ts!=NULL ) {
 						WORD w;
 
@@ -1330,16 +1078,10 @@
 						}
 					}
 					EndDialog(Dialog, 1);
-					if (DlgKeybFont != NULL) {
-						DeleteObject(DlgKeybFont);
-					}
 					return TRUE;
 
 				case IDCANCEL:
 					EndDialog(Dialog, 0);
-					if (DlgKeybFont != NULL) {
-						DeleteObject(DlgKeybFont);
-					}
 					return TRUE;
 
 				case IDC_KEYBHELP:
@@ -1354,8 +1096,23 @@
 static PCHAR StopList[] = {"1 bit", "1.5 bit", "2 bit", NULL};
 static PCHAR FlowList[] = {"Xon/Xoff","hardware","none",NULL};
 
-BOOL CALLBACK SerialDlg(HWND Dialog, UINT Message, WPARAM wParam, LPARAM lParam)
+static INT_PTR CALLBACK SerialDlg(HWND Dialog, UINT Message, WPARAM wParam, LPARAM lParam)
 {
+	static const DlgTextInfo TextInfos[] = {
+		{ 0, "DLG_SERIAL_TITLE" },
+		{ IDC_SERIALPORT_LABEL, "DLG_SERIAL_PORT" },
+		{ IDC_SERIALBAUD_LEBAL, "DLG_SERIAL_BAUD" },
+		{ IDC_SERIALDATA_LABEL, "DLG_SERIAL_DATA" },
+		{ IDC_SERIALPARITY_LABEL, "DLG_SERIAL_PARITY" },
+		{ IDC_SERIALSTOP_LABEL, "DLG_SERIAL_STOP" },
+		{ IDC_SERIALFLOW_LABEL, "DLG_SERIAL_FLOW" },
+		{ IDC_SERIALDELAY, "DLG_SERIAL_DELAY" },
+		{ IDC_SERIALDELAYCHAR_LABEL, "DLG_SERIAL_DELAYCHAR" },
+		{ IDC_SERIALDELAYLINE_LABEL, "DLG_SERIAL_DELAYLINE" },
+		{ IDOK, "BTN_OK" },
+		{ IDCANCEL, "BTN_CANCEL" },
+		{ IDC_SERIALHELP, "BTN_HELP" },
+	};
 	PTTSet ts;
 	int i, w, sel;
 	char Temp[128];
@@ -1362,83 +1119,14 @@
 	WORD ComPortTable[MAXCOMPORT];
 	static char *ComPortDesc[MAXCOMPORT];
 	int comports;
-	char uimsg[MAX_UIMSG], uimsg2[MAX_UIMSG];
-	LOGFONT logfont;
-	HFONT font;
 
 	switch (Message) {
 		case WM_INITDIALOG:
 			ts = (PTTSet)lParam;
-			SetWindowLong(Dialog, DWL_USER, lParam);
+			SetWindowLongPtr(Dialog, DWLP_USER, lParam);
 
-			font = (HFONT)SendMessage(Dialog, WM_GETFONT, 0, 0);
-			GetObject(font, sizeof(LOGFONT), &logfont);
-			if (get_lang_font("DLG_SYSTEM_FONT", Dialog, &logfont, &DlgSerialFont, UILanguageFile)) {
-				SendDlgItemMessage(Dialog, IDC_SERIALPORT_LABEL, WM_SETFONT, (WPARAM)DlgSerialFont, MAKELPARAM(TRUE,0));
-				SendDlgItemMessage(Dialog, IDC_SERIALPORT, WM_SETFONT, (WPARAM)DlgSerialFont, MAKELPARAM(TRUE,0));
-				SendDlgItemMessage(Dialog, IDC_SERIALBAUD_LEBAL, WM_SETFONT, (WPARAM)DlgSerialFont, MAKELPARAM(TRUE,0));
-				SendDlgItemMessage(Dialog, IDC_SERIALBAUD, WM_SETFONT, (WPARAM)DlgSerialFont, MAKELPARAM(TRUE,0));
-				SendDlgItemMessage(Dialog, IDC_SERIALDATA_LABEL, WM_SETFONT, (WPARAM)DlgSerialFont, MAKELPARAM(TRUE,0));
-				SendDlgItemMessage(Dialog, IDC_SERIALDATA, WM_SETFONT, (WPARAM)DlgSerialFont, MAKELPARAM(TRUE,0));
-				SendDlgItemMessage(Dialog, IDC_SERIALPARITY_LABEL, WM_SETFONT, (WPARAM)DlgSerialFont, MAKELPARAM(TRUE,0));
-				SendDlgItemMessage(Dialog, IDC_SERIALPARITY, WM_SETFONT, (WPARAM)DlgSerialFont, MAKELPARAM(TRUE,0));
-				SendDlgItemMessage(Dialog, IDC_SERIALSTOP_LABEL, WM_SETFONT, (WPARAM)DlgSerialFont, MAKELPARAM(TRUE,0));
-				SendDlgItemMessage(Dialog, IDC_SERIALSTOP, WM_SETFONT, (WPARAM)DlgSerialFont, MAKELPARAM(TRUE,0));
-				SendDlgItemMessage(Dialog, IDC_SERIALFLOW_LABEL, WM_SETFONT, (WPARAM)DlgSerialFont, MAKELPARAM(TRUE,0));
-				SendDlgItemMessage(Dialog, IDC_SERIALFLOW, WM_SETFONT, (WPARAM)DlgSerialFont, MAKELPARAM(TRUE,0));
-				SendDlgItemMessage(Dialog, IDC_SERIALDELAY, WM_SETFONT, (WPARAM)DlgSerialFont, MAKELPARAM(TRUE,0));
-				SendDlgItemMessage(Dialog, IDC_SERIALDELAYCHAR_LABEL, WM_SETFONT, (WPARAM)DlgSerialFont, MAKELPARAM(TRUE,0));
-				SendDlgItemMessage(Dialog, IDC_SERIALDELAYCHAR, WM_SETFONT, (WPARAM)DlgSerialFont, MAKELPARAM(TRUE,0));
-				SendDlgItemMessage(Dialog, IDC_SERIALDELAYLINE_LABEL, WM_SETFONT, (WPARAM)DlgSerialFont, MAKELPARAM(TRUE,0));
-				SendDlgItemMessage(Dialog, IDC_SERIALDELAYLINE, WM_SETFONT, (WPARAM)DlgSerialFont, MAKELPARAM(TRUE,0));
-				SendDlgItemMessage(Dialog, IDOK, WM_SETFONT, (WPARAM)DlgSerialFont, MAKELPARAM(TRUE,0));
-				SendDlgItemMessage(Dialog, IDCANCEL, WM_SETFONT, (WPARAM)DlgSerialFont, MAKELPARAM(TRUE,0));
-				SendDlgItemMessage(Dialog, IDC_SERIALHELP, WM_SETFONT, (WPARAM)DlgSerialFont, MAKELPARAM(TRUE,0));
-			}
-			else {
-				DlgSerialFont = NULL;
-			}
+			SetDlgTexts(Dialog, TextInfos, _countof(TextInfos), UILanguageFile);
 
-			GetWindowText(Dialog, uimsg2, sizeof(uimsg2));
-			get_lang_msg("DLG_SERIAL_TITLE", uimsg, sizeof(uimsg), uimsg2, UILanguageFile);
-			SetWindowText(Dialog, uimsg);
-			GetDlgItemText(Dialog, IDC_SERIALPORT_LABEL, uimsg2, sizeof(uimsg2));
-			get_lang_msg("DLG_SERIAL_PORT", uimsg, sizeof(uimsg), uimsg2, UILanguageFile);
-			SetDlgItemText(Dialog, IDC_SERIALPORT_LABEL, uimsg);
-			GetDlgItemText(Dialog, IDC_SERIALBAUD_LEBAL, uimsg2, sizeof(uimsg2));
-			get_lang_msg("DLG_SERIAL_BAUD", uimsg, sizeof(uimsg), uimsg2, UILanguageFile);
-			SetDlgItemText(Dialog, IDC_SERIALBAUD_LEBAL, uimsg);
-			GetDlgItemText(Dialog, IDC_SERIALDATA_LABEL, uimsg2, sizeof(uimsg2));
-			get_lang_msg("DLG_SERIAL_DATA", uimsg, sizeof(uimsg), uimsg2, UILanguageFile);
-			SetDlgItemText(Dialog, IDC_SERIALDATA_LABEL, uimsg);
-			GetDlgItemText(Dialog, IDC_SERIALPARITY_LABEL, uimsg2, sizeof(uimsg2));
-			get_lang_msg("DLG_SERIAL_PARITY", uimsg, sizeof(uimsg), uimsg2, UILanguageFile);
-			SetDlgItemText(Dialog, IDC_SERIALPARITY_LABEL, uimsg);
-			GetDlgItemText(Dialog, IDC_SERIALSTOP_LABEL, uimsg2, sizeof(uimsg2));
-			get_lang_msg("DLG_SERIAL_STOP", uimsg, sizeof(uimsg), uimsg2, UILanguageFile);
-			SetDlgItemText(Dialog, IDC_SERIALSTOP_LABEL, uimsg);
-			GetDlgItemText(Dialog, IDC_SERIALFLOW_LABEL, uimsg2, sizeof(uimsg2));
-			get_lang_msg("DLG_SERIAL_FLOW", uimsg, sizeof(uimsg), uimsg2, UILanguageFile);
-			SetDlgItemText(Dialog, IDC_SERIALFLOW_LABEL, uimsg);
-			GetDlgItemText(Dialog, IDC_SERIALDELAY, uimsg2, sizeof(uimsg2));
-			get_lang_msg("DLG_SERIAL_DELAY", uimsg, sizeof(uimsg), uimsg2, UILanguageFile);
-			SetDlgItemText(Dialog, IDC_SERIALDELAY, uimsg);
-			GetDlgItemText(Dialog, IDC_SERIALDELAYCHAR_LABEL, uimsg2, sizeof(uimsg2));
-			get_lang_msg("DLG_SERIAL_DELAYCHAR", uimsg, sizeof(uimsg), uimsg2, UILanguageFile);
-			SetDlgItemText(Dialog, IDC_SERIALDELAYCHAR_LABEL, uimsg);
-			GetDlgItemText(Dialog, IDC_SERIALDELAYLINE_LABEL, uimsg2, sizeof(uimsg2));
-			get_lang_msg("DLG_SERIAL_DELAYLINE", uimsg, sizeof(uimsg), uimsg2, UILanguageFile);
-			SetDlgItemText(Dialog, IDC_SERIALDELAYLINE_LABEL, uimsg);
-			GetDlgItemText(Dialog, IDOK, uimsg2, sizeof(uimsg2));
-			get_lang_msg("BTN_OK", uimsg, sizeof(uimsg), uimsg2, UILanguageFile);
-			SetDlgItemText(Dialog, IDOK, uimsg);
-			GetDlgItemText(Dialog, IDCANCEL, uimsg2, sizeof(uimsg2));
-			get_lang_msg("BTN_CANCEL", uimsg, sizeof(uimsg), uimsg2, UILanguageFile);
-			SetDlgItemText(Dialog, IDCANCEL, uimsg);
-			GetDlgItemText(Dialog, IDC_SERIALHELP, uimsg2, sizeof(uimsg2));
-			get_lang_msg("BTN_HELP", uimsg, sizeof(uimsg), uimsg2, UILanguageFile);
-			SetDlgItemText(Dialog, IDC_SERIALHELP, uimsg);
-
 			w = 0;
 
 			if ((comports = DetectComPorts(ComPortTable, ts->MaxComPort, ComPortDesc)) > 0) {
@@ -1543,16 +1231,10 @@
 					}
 
 					EndDialog(Dialog, 1);
-					if (DlgSerialFont != NULL) {
-						DeleteObject(DlgSerialFont);
-					}
 					return TRUE;
 
 				case IDCANCEL:
 					EndDialog(Dialog, 0);
-					if (DlgSerialFont != NULL) {
-						DeleteObject(DlgSerialFont);
-					}
 					return TRUE;
 
 				case IDC_SERIALHELP:
@@ -1562,8 +1244,26 @@
 	return FALSE;
 }
 
-BOOL CALLBACK TCPIPDlg(HWND Dialog, UINT Message, WPARAM wParam, LPARAM lParam)
+static INT_PTR CALLBACK TCPIPDlg(HWND Dialog, UINT Message, WPARAM wParam, LPARAM lParam)
 {
+	static const DlgTextInfo TextInfos[] = {
+		{ 0, "DLG_TCPIP_TITLE" },
+		{ IDC_TCPIPHOSTLIST, "DLG_TCPIP_HOSTLIST" },
+		{ IDC_TCPIPADD, "DLG_TCPIP_ADD" },
+		{ IDC_TCPIPUP, "DLG_TCPIP_UP" },
+		{ IDC_TCPIPREMOVE, "DLG_TCPIP_REMOVE" },
+		{ IDC_TCPIPDOWN, "DLG_TCPIP_DOWN" },
+		{ IDC_TCPIPHISTORY, "DLG_TCPIP_HISTORY" },
+		{ IDC_TCPIPAUTOCLOSE, "DLG_TCPIP_AUTOCLOSE" },
+		{ IDC_TCPIPPORTLABEL, "DLG_TCPIP_PORT" },
+		{ IDC_TCPIPTELNET, "DLG_TCPIP_TELNET" },
+		{ IDC_TCPIPTELNETKEEPALIVELABEL, "DLG_TCPIP_KEEPALIVE" },
+		{ IDC_TCPIPTELNETKEEPALIVESEC, "DLG_TCPIP_KEEPALIVE_SEC" },
+		{ IDC_TCPIPTERMTYPELABEL, "DLG_TCPIP_TERMTYPE" },
+		{ IDOK, "BTN_OK" },
+		{ IDCANCEL, "BTN_CANCEL" },
+		{ IDC_TCPIPHELP, "BTN_HELP" },
+	};
 	PTTSet ts;
 	char EntName[10];
 	char TempHost[HostNameMaxLength+1];
@@ -1570,92 +1270,14 @@
 	UINT i, Index;
 	WORD w;
 	BOOL Ok;
-	char uimsg[MAX_UIMSG], uimsg2[MAX_UIMSG];
-	LOGFONT logfont;
-	HFONT font;
 
 	switch (Message) {
 		case WM_INITDIALOG:
 			ts = (PTTSet)lParam;
-			SetWindowLong(Dialog, DWL_USER, lParam);
+			SetWindowLongPtr(Dialog, DWLP_USER, lParam);
 
-			font = (HFONT)SendMessage(Dialog, WM_GETFONT, 0, 0);
-			GetObject(font, sizeof(LOGFONT), &logfont);
-			if (get_lang_font("DLG_SYSTEM_FONT", Dialog, &logfont, &DlgTcpipFont, UILanguageFile)) {
-				SendDlgItemMessage(Dialog, IDC_TCPIPHOSTLIST, WM_SETFONT, (WPARAM)DlgTcpipFont, MAKELPARAM(TRUE,0));
-				SendDlgItemMessage(Dialog, IDC_TCPIPHOST, WM_SETFONT, (WPARAM)DlgTcpipFont, MAKELPARAM(TRUE,0));
-				SendDlgItemMessage(Dialog, IDC_TCPIPADD, WM_SETFONT, (WPARAM)DlgTcpipFont, MAKELPARAM(TRUE,0));
-				SendDlgItemMessage(Dialog, IDC_TCPIPLIST, WM_SETFONT, (WPARAM)DlgTcpipFont, MAKELPARAM(TRUE,0));
-				SendDlgItemMessage(Dialog, IDC_TCPIPUP, WM_SETFONT, (WPARAM)DlgTcpipFont, MAKELPARAM(TRUE,0));
-				SendDlgItemMessage(Dialog, IDC_TCPIPREMOVE, WM_SETFONT, (WPARAM)DlgTcpipFont, MAKELPARAM(TRUE,0));
-				SendDlgItemMessage(Dialog, IDC_TCPIPDOWN, WM_SETFONT, (WPARAM)DlgTcpipFont, MAKELPARAM(TRUE,0));
-				SendDlgItemMessage(Dialog, IDC_TCPIPTELNETKEEPALIVELABEL, WM_SETFONT, (WPARAM)DlgTcpipFont, MAKELPARAM(TRUE,0));
-				SendDlgItemMessage(Dialog, IDC_TCPIPTELNETKEEPALIVE, WM_SETFONT, (WPARAM)DlgTcpipFont, MAKELPARAM(TRUE,0));
-				SendDlgItemMessage(Dialog, IDC_TCPIPTELNETKEEPALIVESEC, WM_SETFONT, (WPARAM)DlgTcpipFont, MAKELPARAM(TRUE,0));
-				SendDlgItemMessage(Dialog, IDC_TCPIPHISTORY, WM_SETFONT, (WPARAM)DlgTcpipFont, MAKELPARAM(TRUE,0));
-				SendDlgItemMessage(Dialog, IDC_TCPIPAUTOCLOSE, WM_SETFONT, (WPARAM)DlgTcpipFont, MAKELPARAM(TRUE,0));
-				SendDlgItemMessage(Dialog, IDC_TCPIPPORTLABEL, WM_SETFONT, (WPARAM)DlgTcpipFont, MAKELPARAM(TRUE,0));
-				SendDlgItemMessage(Dialog, IDC_TCPIPPORT, WM_SETFONT, (WPARAM)DlgTcpipFont, MAKELPARAM(TRUE,0));
-				SendDlgItemMessage(Dialog, IDC_TCPIPTELNET, WM_SETFONT, (WPARAM)DlgTcpipFont, MAKELPARAM(TRUE,0));
-				SendDlgItemMessage(Dialog, IDC_TCPIPTERMTYPELABEL, WM_SETFONT, (WPARAM)DlgTcpipFont, MAKELPARAM(TRUE,0));
-				SendDlgItemMessage(Dialog, IDC_TCPIPTERMTYPE, WM_SETFONT, (WPARAM)DlgTcpipFont, MAKELPARAM(TRUE,0));
-				SendDlgItemMessage(Dialog, IDOK, WM_SETFONT, (WPARAM)DlgTcpipFont, MAKELPARAM(TRUE,0));
-				SendDlgItemMessage(Dialog, IDCANCEL, WM_SETFONT, (WPARAM)DlgTcpipFont, MAKELPARAM(TRUE,0));
-				SendDlgItemMessage(Dialog, IDC_TCPIPHELP, WM_SETFONT, (WPARAM)DlgTcpipFont, MAKELPARAM(TRUE,0));
-			}
-			else {
-				DlgTcpipFont = NULL;
-			}
-
-			GetWindowText(Dialog, uimsg2, sizeof(uimsg2));
-			get_lang_msg("DLG_TCPIP_TITLE", uimsg, sizeof(uimsg), uimsg2, UILanguageFile);
-			SetWindowText(Dialog, uimsg);
-			GetDlgItemText(Dialog, IDC_TCPIPHOSTLIST, uimsg2, sizeof(uimsg2));
-			get_lang_msg("DLG_TCPIP_HOSTLIST", uimsg, sizeof(uimsg), uimsg2, UILanguageFile);
-			SetDlgItemText(Dialog, IDC_TCPIPHOSTLIST, uimsg);
-			GetDlgItemText(Dialog, IDC_TCPIPADD, uimsg2, sizeof(uimsg2));
-			get_lang_msg("DLG_TCPIP_ADD", uimsg, sizeof(uimsg), uimsg2, UILanguageFile);
-			SetDlgItemText(Dialog, IDC_TCPIPADD, uimsg);
-			GetDlgItemText(Dialog, IDC_TCPIPUP, uimsg2, sizeof(uimsg2));
-			get_lang_msg("DLG_TCPIP_UP", uimsg, sizeof(uimsg), uimsg2, UILanguageFile);
-			SetDlgItemText(Dialog, IDC_TCPIPUP, uimsg);
-			GetDlgItemText(Dialog, IDC_TCPIPREMOVE, uimsg2, sizeof(uimsg2));
-			get_lang_msg("DLG_TCPIP_REMOVE", uimsg, sizeof(uimsg), uimsg2, UILanguageFile);
-			SetDlgItemText(Dialog, IDC_TCPIPREMOVE, uimsg);
-			GetDlgItemText(Dialog, IDC_TCPIPDOWN, uimsg2, sizeof(uimsg2));
-			get_lang_msg("DLG_TCPIP_DOWN", uimsg, sizeof(uimsg), uimsg2, UILanguageFile);
-			SetDlgItemText(Dialog, IDC_TCPIPDOWN, uimsg);
-			GetDlgItemText(Dialog, IDC_TCPIPHISTORY, uimsg2, sizeof(uimsg2));
-			get_lang_msg("DLG_TCPIP_HISTORY", uimsg, sizeof(uimsg), uimsg2, UILanguageFile);
-			SetDlgItemText(Dialog, IDC_TCPIPHISTORY, uimsg);
-			GetDlgItemText(Dialog, IDC_TCPIPAUTOCLOSE, uimsg2, sizeof(uimsg2));
-			get_lang_msg("DLG_TCPIP_AUTOCLOSE", uimsg, sizeof(uimsg), uimsg2, UILanguageFile);
-			SetDlgItemText(Dialog, IDC_TCPIPAUTOCLOSE, uimsg);
-			GetDlgItemText(Dialog, IDC_TCPIPPORTLABEL, uimsg2, sizeof(uimsg2));
-			get_lang_msg("DLG_TCPIP_PORT", uimsg, sizeof(uimsg), uimsg2, UILanguageFile);
-			SetDlgItemText(Dialog, IDC_TCPIPPORTLABEL, uimsg);
-			GetDlgItemText(Dialog, IDC_TCPIPTELNET, uimsg2, sizeof(uimsg2));
-			get_lang_msg("DLG_TCPIP_TELNET", uimsg, sizeof(uimsg), uimsg2, UILanguageFile);
-			SetDlgItemText(Dialog, IDC_TCPIPTELNET, uimsg);
-			GetDlgItemText(Dialog, IDC_TCPIPTELNETKEEPALIVELABEL, uimsg2, sizeof(uimsg2));
-			get_lang_msg("DLG_TCPIP_KEEPALIVE", uimsg, sizeof(uimsg), uimsg2, UILanguageFile);
-			SetDlgItemText(Dialog, IDC_TCPIPTELNETKEEPALIVELABEL, uimsg);
-			GetDlgItemText(Dialog, IDC_TCPIPTELNETKEEPALIVESEC, uimsg2, sizeof(uimsg2));
-			get_lang_msg("DLG_TCPIP_KEEPALIVE_SEC", uimsg, sizeof(uimsg), uimsg2, UILanguageFile);
-			SetDlgItemText(Dialog, IDC_TCPIPTELNETKEEPALIVESEC, uimsg);
-			GetDlgItemText(Dialog, IDC_TCPIPTERMTYPELABEL, uimsg2, sizeof(uimsg2));
-			get_lang_msg("DLG_TCPIP_TERMTYPE", uimsg, sizeof(uimsg), uimsg2, UILanguageFile);
-			SetDlgItemText(Dialog, IDC_TCPIPTERMTYPELABEL, uimsg);
-			GetDlgItemText(Dialog, IDOK, uimsg2, sizeof(uimsg2));
-			get_lang_msg("BTN_OK", uimsg, sizeof(uimsg), uimsg2, UILanguageFile);
-			SetDlgItemText(Dialog, IDOK, uimsg);
-			GetDlgItemText(Dialog, IDCANCEL, uimsg2, sizeof(uimsg2));
-			get_lang_msg("BTN_CANCEL", uimsg, sizeof(uimsg), uimsg2, UILanguageFile);
-			SetDlgItemText(Dialog, IDCANCEL, uimsg);
-			GetDlgItemText(Dialog, IDC_TCPIPHELP, uimsg2, sizeof(uimsg2));
-			get_lang_msg("BTN_HELP", uimsg, sizeof(uimsg), uimsg2, UILanguageFile);
-			SetDlgItemText(Dialog, IDC_TCPIPHELP, uimsg);
-
+			SetDlgTexts(Dialog, TextInfos, _countof(TextInfos), UILanguageFile);
+				
 			SendDlgItemMessage(Dialog, IDC_TCPIPHOST, EM_LIMITTEXT,
 			                   HostNameMaxLength-1, 0);
 
@@ -1722,16 +1344,10 @@
 						               sizeof(ts->TermType));
 					}
 					EndDialog(Dialog, 1);
-					if (DlgTcpipFont != NULL) {
-						DeleteObject(DlgTcpipFont);
-					}
 					return TRUE;
 
 				case IDCANCEL:
 					EndDialog(Dialog, 0);
-					if (DlgTcpipFont != NULL) {
-						DeleteObject(DlgTcpipFont);
-					}
 					return TRUE;
 
 				case IDC_TCPIPHOST:
@@ -1864,8 +1480,19 @@
 	return FALSE;
 }
 
-BOOL CALLBACK HostDlg(HWND Dialog, UINT Message, WPARAM wParam, LPARAM lParam)
+static INT_PTR CALLBACK HostDlg(HWND Dialog, UINT Message, WPARAM wParam, LPARAM lParam)
 {
+	static const DlgTextInfo TextInfos[] = {
+		{ 0, "DLG_HOST_TITLE" },
+		{ IDC_HOSTNAMELABEL, "DLG_HOST_TCPIPHOST" },
+		{ IDC_HOSTTCPPORTLABEL, "DLG_HOST_TCPIPPORT" },
+		{ IDC_HOSTTCPPROTOCOLLABEL, "DLG_HOST_TCPIPPROTOCOL" },
+		{ IDC_HOSTSERIAL, "DLG_HOST_SERIAL" },
+		{ IDC_HOSTCOMLABEL, "DLG_HOST_SERIALPORT" },
+		{ IDOK, "BTN_OK" },
+		{ IDCANCEL, "BTN_CANCEL" },
+		{ IDC_HOSTHELP, "BTN_HELP" },
+	};
 	PGetHNRec GetHNRec;
 	char EntName[128];
 	char TempHost[HostNameMaxLength+1];
@@ -1874,65 +1501,14 @@
 	WORD ComPortTable[MAXCOMPORT];
 	static char *ComPortDesc[MAXCOMPORT];
 	int comports;
-	char uimsg[MAX_UIMSG], uimsg2[MAX_UIMSG];
-	LOGFONT logfont;
-	HFONT font;
 
 	switch (Message) {
 		case WM_INITDIALOG:
 			GetHNRec = (PGetHNRec)lParam;
-			SetWindowLong(Dialog, DWL_USER, lParam);
+			SetWindowLongPtr(Dialog, DWLP_USER, lParam);
 
-			font = (HFONT)SendMessage(Dialog, WM_GETFONT, 0, 0);
-			GetObject(font, sizeof(LOGFONT), &logfont);
-			if (get_lang_font("DLG_SYSTEM_FONT", Dialog, &logfont, &DlgHostFont, UILanguageFile)) {
-				SendDlgItemMessage(Dialog, IDC_HOSTTCPIP, WM_SETFONT, (WPARAM)DlgHostFont, MAKELPARAM(TRUE,0));
-				SendDlgItemMessage(Dialog, IDC_HOSTNAMELABEL, WM_SETFONT, (WPARAM)DlgHostFont, MAKELPARAM(TRUE,0));
-				SendDlgItemMessage(Dialog, IDC_HOSTNAME, WM_SETFONT, (WPARAM)DlgHostFont, MAKELPARAM(TRUE,0));
-				SendDlgItemMessage(Dialog, IDC_HOSTTELNET, WM_SETFONT, (WPARAM)DlgHostFont, MAKELPARAM(TRUE,0));
-				SendDlgItemMessage(Dialog, IDC_HOSTTCPPORTLABEL, WM_SETFONT, (WPARAM)DlgHostFont, MAKELPARAM(TRUE,0));
-				SendDlgItemMessage(Dialog, IDC_HOSTTCPPORT, WM_SETFONT, (WPARAM)DlgHostFont, MAKELPARAM(TRUE,0));
-				SendDlgItemMessage(Dialog, IDC_HOSTTCPPROTOCOLLABEL, WM_SETFONT, (WPARAM)DlgHostFont, MAKELPARAM(TRUE,0));
-				SendDlgItemMessage(Dialog, IDC_HOSTTCPPROTOCOL, WM_SETFONT, (WPARAM)DlgHostFont, MAKELPARAM(TRUE,0));
-				SendDlgItemMessage(Dialog, IDC_HOSTSERIAL, WM_SETFONT, (WPARAM)DlgHostFont, MAKELPARAM(TRUE,0));
-				SendDlgItemMessage(Dialog, IDC_HOSTCOMLABEL, WM_SETFONT, (WPARAM)DlgHostFont, MAKELPARAM(TRUE,0));
-				SendDlgItemMessage(Dialog, IDC_HOSTCOM, WM_SETFONT, (WPARAM)DlgHostFont, MAKELPARAM(TRUE,0));
-				SendDlgItemMessage(Dialog, IDOK, WM_SETFONT, (WPARAM)DlgHostFont, MAKELPARAM(TRUE,0));
-				SendDlgItemMessage(Dialog, IDCANCEL, WM_SETFONT, (WPARAM)DlgHostFont, MAKELPARAM(TRUE,0));
-				SendDlgItemMessage(Dialog, IDC_HOSTHELP, WM_SETFONT, (WPARAM)DlgHostFont, MAKELPARAM(TRUE,0));
-			}
-			else {
-				DlgHostFont = NULL;
-			}
-
-			GetWindowText(Dialog, uimsg2, sizeof(uimsg2));
-			get_lang_msg("DLG_HOST_TITLE", uimsg, sizeof(uimsg), uimsg2, UILanguageFile);
-			SetWindowText(Dialog, uimsg);
-			GetDlgItemText(Dialog, IDC_HOSTNAMELABEL, uimsg2, sizeof(uimsg2));
-			get_lang_msg("DLG_HOST_TCPIPHOST", uimsg, sizeof(uimsg), uimsg2, UILanguageFile);
-			SetDlgItemText(Dialog, IDC_HOSTNAMELABEL, uimsg);
-			GetDlgItemText(Dialog, IDC_HOSTTCPPORTLABEL, uimsg2, sizeof(uimsg2));
-			get_lang_msg("DLG_HOST_TCPIPPORT", uimsg, sizeof(uimsg), uimsg2, UILanguageFile);
-			SetDlgItemText(Dialog, IDC_HOSTTCPPORTLABEL, uimsg);
-			GetDlgItemText(Dialog, IDC_HOSTTCPPROTOCOLLABEL, uimsg2, sizeof(uimsg2));
-			get_lang_msg("DLG_HOST_TCPIPPROTOCOL", uimsg, sizeof(uimsg), uimsg2, UILanguageFile);
-			SetDlgItemText(Dialog, IDC_HOSTTCPPROTOCOLLABEL, uimsg);
-			GetDlgItemText(Dialog, IDC_HOSTSERIAL, uimsg2, sizeof(uimsg2));
-			get_lang_msg("DLG_HOST_SERIAL", uimsg, sizeof(uimsg), uimsg2, UILanguageFile);
-			SetDlgItemText(Dialog, IDC_HOSTSERIAL, uimsg);
-			GetDlgItemText(Dialog, IDC_HOSTCOMLABEL, uimsg2, sizeof(uimsg2));
-			get_lang_msg("DLG_HOST_SERIALPORT", uimsg, sizeof(uimsg), uimsg2, UILanguageFile);
-			SetDlgItemText(Dialog, IDC_HOSTCOMLABEL, uimsg);
-			GetDlgItemText(Dialog, IDOK, uimsg2, sizeof(uimsg2));
-			get_lang_msg("BTN_OK", uimsg, sizeof(uimsg), uimsg2, UILanguageFile);
-			SetDlgItemText(Dialog, IDOK, uimsg);
-			GetDlgItemText(Dialog, IDCANCEL, uimsg2, sizeof(uimsg2));
-			get_lang_msg("BTN_CANCEL", uimsg, sizeof(uimsg), uimsg2, UILanguageFile);
-			SetDlgItemText(Dialog, IDCANCEL, uimsg);
-			GetDlgItemText(Dialog, IDC_HOSTHELP, uimsg2, sizeof(uimsg2));
-			get_lang_msg("BTN_HELP", uimsg, sizeof(uimsg), uimsg2, UILanguageFile);
-			SetDlgItemText(Dialog, IDC_HOSTHELP, uimsg);
-
+			SetDlgTexts(Dialog, TextInfos, _countof(TextInfos), UILanguageFile);
+		
 			// \x83t\x83@\x83C\x83\x8B\x82\xA8\x82\xE6\x82і\xBC\x91O\x95t\x82\xAB\x83p\x83C\x83v\x82̏ꍇ\x81ATCP/IP\x88\xB5\x82\xA2\x82Ƃ\xB7\x82\xE9\x81B
 			if ( GetHNRec->PortType==IdFile ||
 				 GetHNRec->PortType==IdNamedPipe
@@ -2074,16 +1650,10 @@
 						}
 					}
 					EndDialog(Dialog, 1);
-					if (DlgHostFont != NULL) {
-						DeleteObject(DlgHostFont);
-					}
 					return TRUE;
 
 				case IDCANCEL:
 					EndDialog(Dialog, 0);
-					if (DlgHostFont != NULL) {
-						DeleteObject(DlgHostFont);
-					}
 					return TRUE;
 
 				case IDC_HOSTTCPIP:
@@ -2138,8 +1708,16 @@
 	return FALSE;
 }
 
-BOOL CALLBACK DirDlg(HWND Dialog, UINT Message, WPARAM wParam, LPARAM lParam)
+static INT_PTR CALLBACK DirDlg(HWND Dialog, UINT Message, WPARAM wParam, LPARAM lParam)
 {
+	static const DlgTextInfo TextInfos[] = {
+		{ 0, "DLG_DIR_TITLE" },
+		{ IDC_DIRCURRENT_LABEL, "DLG_DIR_CURRENT" },
+		{ IDC_DIRNEW_LABEL, "DLG_DIR_NEW" },
+		{ IDOK, "BTN_OK" },
+		{ IDCANCEL, "BTN_CANCEL" },
+		{ IDC_DIRHELP, "BTN_HELP" },
+	};
 	PCHAR CurDir;
 	char HomeDir[MAXPATHLEN];
 	char TmpDir[MAXPATHLEN];
@@ -2151,47 +1729,14 @@
 	int WX, WY, WW, WH, CW, DW, DH, BW, BH, SW, SH;
 	char uimsg[MAX_UIMSG], uimsg2[MAX_UIMSG];
 	char buf[MAX_PATH], buf2[MAX_PATH];
-	LOGFONT logfont;
-	HFONT font;
 
 	switch (Message) {
 		case WM_INITDIALOG:
-			font = (HFONT)SendMessage(Dialog, WM_GETFONT, 0, 0);
-			GetObject(font, sizeof(LOGFONT), &logfont);
-			if (get_lang_font("DLG_SYSTEM_FONT", Dialog, &logfont, &DlgDirFont, UILanguageFile)) {
-				SendDlgItemMessage(Dialog, IDC_DIRCURRENT_LABEL, WM_SETFONT, (WPARAM)DlgDirFont, MAKELPARAM(TRUE,0));
-				SendDlgItemMessage(Dialog, IDC_DIRCURRENT, WM_SETFONT, (WPARAM)DlgDirFont, MAKELPARAM(TRUE,0));
-				SendDlgItemMessage(Dialog, IDC_DIRNEW_LABEL, WM_SETFONT, (WPARAM)DlgDirFont, MAKELPARAM(TRUE,0));
-				SendDlgItemMessage(Dialog, IDC_DIRNEW, WM_SETFONT, (WPARAM)DlgDirFont, MAKELPARAM(TRUE,0));
-				SendDlgItemMessage(Dialog, IDOK, WM_SETFONT, (WPARAM)DlgDirFont, MAKELPARAM(TRUE,0));
-				SendDlgItemMessage(Dialog, IDCANCEL, WM_SETFONT, (WPARAM)DlgDirFont, MAKELPARAM(TRUE,0));
-				SendDlgItemMessage(Dialog, IDC_DIRHELP, WM_SETFONT, (WPARAM)DlgDirFont, MAKELPARAM(TRUE,0));
-			}
-			else {
-				DlgDirFont = NULL;
-			}
 
-			GetWindowText(Dialog, uimsg2, sizeof(uimsg2));
-			get_lang_msg("DLG_DIR_TITLE", uimsg, sizeof(uimsg), uimsg2, UILanguageFile);
-			SetWindowText(Dialog, uimsg);
-			GetDlgItemText(Dialog, IDC_DIRCURRENT_LABEL, uimsg2, sizeof(uimsg2));
-			get_lang_msg("DLG_DIR_CURRENT", uimsg, sizeof(uimsg), uimsg2, UILanguageFile);
-			SetDlgItemText(Dialog, IDC_DIRCURRENT_LABEL, uimsg);
-			GetDlgItemText(Dialog, IDC_DIRNEW_LABEL, uimsg2, sizeof(uimsg2));
-			get_lang_msg("DLG_DIR_NEW", uimsg, sizeof(uimsg), uimsg2, UILanguageFile);
-			SetDlgItemText(Dialog, IDC_DIRNEW_LABEL, uimsg);
-			GetDlgItemText(Dialog, IDOK, uimsg2, sizeof(uimsg2));
-			get_lang_msg("BTN_OK", uimsg, sizeof(uimsg), uimsg2, UILanguageFile);
-			SetDlgItemText(Dialog, IDOK, uimsg);
-			GetDlgItemText(Dialog, IDCANCEL, uimsg2, sizeof(uimsg2));
-			get_lang_msg("BTN_CANCEL", uimsg, sizeof(uimsg), uimsg2, UILanguageFile);
-			SetDlgItemText(Dialog, IDCANCEL, uimsg);
-			GetDlgItemText(Dialog, IDC_DIRHELP, uimsg2, sizeof(uimsg2));
-			get_lang_msg("BTN_HELP", uimsg, sizeof(uimsg), uimsg2, UILanguageFile);
-			SetDlgItemText(Dialog, IDC_DIRHELP, uimsg);
-
+			SetDlgTexts(Dialog, TextInfos, _countof(TextInfos), UILanguageFile);
+				
 			CurDir = (PCHAR)(lParam);
-			SetWindowLong(Dialog, DWL_USER, lParam);
+			SetWindowLongPtr(Dialog, DWLP_USER, lParam);
 
 			SetDlgItemText(Dialog, IDC_DIRCURRENT, CurDir);
 			SendDlgItemMessage(Dialog, IDC_DIRNEW, EM_LIMITTEXT,
@@ -2288,16 +1833,10 @@
 						_chdir(HomeDir);
 					}
 					EndDialog(Dialog, 1);
-					if (DlgDirFont != NULL) {
-						DeleteObject(DlgDirFont);
-					}
 					return TRUE;
 
 				case IDCANCEL:
 					EndDialog(Dialog, 0);
-					if (DlgDirFont != NULL) {
-						DeleteObject(DlgDirFont);
-					}
 					return TRUE;
 
 				case IDC_SELECT_DIR:
@@ -2494,7 +2033,6 @@
 {
 	HFONT hFont;
 	LOGFONT lf;
-	LONG_PTR lptr;
 
 	//SetCapture(hWnd);
 
@@ -2503,7 +2041,7 @@
 	}
 
 	// \x90e\x82̃v\x83\x8D\x83V\x81[\x83W\x83\x83\x82\xF0\x83T\x83u\x83N\x83\x89\x83X\x82\xA9\x82\xE7\x8EQ\x8FƂł\xAB\x82\xE9\x82悤\x82ɁA\x83|\x83C\x83\x93\x83^\x82\xF0\x93o\x98^\x82\xB5\x82Ă\xA8\x82\xAD\x81B
-	lptr = SetWindowLongPtr( hWnd, GWLP_USERDATA, (LONG_PTR)parent );
+	SetWindowLongPtr( hWnd, GWLP_USERDATA, (LONG_PTR)parent );
 	// \x83T\x83u\x83N\x83\x89\x83X\x82̃v\x83\x8D\x83V\x81[\x83W\x83\x83\x82\xF0\x93o\x98^\x82\xB7\x82\xE9\x81B
 	parent->proc = (WNDPROC)SetWindowLongPtr( hWnd, GWLP_WNDPROC, (LONG_PTR)UrlWndProc);
 
@@ -2521,8 +2059,11 @@
 }
 
 
-BOOL CALLBACK AboutDlg(HWND Dialog, UINT Message, WPARAM wParam, LPARAM lParam)
+static INT_PTR CALLBACK AboutDlg(HWND Dialog, UINT Message, WPARAM wParam, LPARAM lParam)
 {
+	static const DlgTextInfo TextInfos[] = {
+		{ 0, "DLG_ABOUT_TITLE" },
+	};
 	char buf[128], tmpbuf[128];
 	HDC hdc;
 	HWND hwnd;
@@ -2530,9 +2071,7 @@
 	DWORD dwExt;
 	WORD w, h;
 	POINT point;
-	char uimsg[MAX_UIMSG], uimsg2[MAX_UIMSG];
-	LOGFONT logfont;
-	HFONT font;
+	char uimsg[MAX_UIMSG];
 	int msc_ver, vs_ver, msc_low_ver;
 
 #if defined(EFFECT_ENABLED) || defined(TEXTURE_ENABLED)
@@ -2559,31 +2098,6 @@
 
 	switch (Message) {
 		case WM_INITDIALOG:
-
-			font = (HFONT)SendMessage(Dialog, WM_GETFONT, 0, 0);
-			GetObject(font, sizeof(LOGFONT), &logfont);
-			if (get_lang_font("DLG_SYSTEM_FONT", Dialog, &logfont, &DlgAboutFont, UILanguageFile)) {
-				SendDlgItemMessage(Dialog, IDC_TT_PRO, WM_SETFONT, (WPARAM)DlgAboutFont, MAKELPARAM(TRUE,0));
-				SendDlgItemMessage(Dialog, IDC_TT_VERSION, WM_SETFONT, (WPARAM)DlgAboutFont, MAKELPARAM(TRUE,0));
-				SendDlgItemMessage(Dialog, IDC_INLUCDE_LABEL, WM_SETFONT, (WPARAM)DlgAboutFont, MAKELPARAM(TRUE,0));
-				SendDlgItemMessage(Dialog, IDC_ONIGURUMA_LABEL, WM_SETFONT, (WPARAM)DlgAboutFont, MAKELPARAM(TRUE,0));
-				SendDlgItemMessage(Dialog, IDC_TT23_LABEL, WM_SETFONT, (WPARAM)DlgAboutFont, MAKELPARAM(TRUE,0));
-				SendDlgItemMessage(Dialog, IDC_TT23DATE_LABEL, WM_SETFONT, (WPARAM)DlgAboutFont, MAKELPARAM(TRUE,0));
-				SendDlgItemMessage(Dialog, IDC_TERANISHI_LABEL, WM_SETFONT, (WPARAM)DlgAboutFont, MAKELPARAM(TRUE,0));
-				SendDlgItemMessage(Dialog, IDC_PROJECT_LABEL, WM_SETFONT, (WPARAM)DlgAboutFont, MAKELPARAM(TRUE,0));
-				SendDlgItemMessage(Dialog, IDC_RIGHTS_LABEL, WM_SETFONT, (WPARAM)DlgAboutFont, MAKELPARAM(TRUE,0));
-				SendDlgItemMessage(Dialog, IDC_AUTHOR_LABEL, WM_SETFONT, (WPARAM)DlgAboutFont, MAKELPARAM(TRUE,0));
-				SendDlgItemMessage(Dialog, IDC_AUTHOR_URL, WM_SETFONT, (WPARAM)DlgAboutFont, MAKELPARAM(TRUE,0));
-				SendDlgItemMessage(Dialog, IDC_FORUM_LABEL, WM_SETFONT, (WPARAM)DlgAboutFont, MAKELPARAM(TRUE,0));
-				SendDlgItemMessage(Dialog, IDC_FORUM_URL, WM_SETFONT, (WPARAM)DlgAboutFont, MAKELPARAM(TRUE,0));
-				SendDlgItemMessage(Dialog, IDC_BUILDTIME, WM_SETFONT, (WPARAM)DlgAboutFont, MAKELPARAM(TRUE,0));
-				SendDlgItemMessage(Dialog, IDC_BUILDTOOL, WM_SETFONT, (WPARAM)DlgAboutFont, MAKELPARAM(TRUE,0));
-				SendDlgItemMessage(Dialog, IDOK, WM_SETFONT, (WPARAM)DlgAboutFont, MAKELPARAM(TRUE,0));
-			}
-			else {
-				DlgAboutFont = NULL;
-			}
-
 			// \x83A\x83C\x83R\x83\x93\x82𓮓I\x82ɃZ\x83b\x83g
 			{
 				int fuLoad = LR_DEFAULTCOLOR;
@@ -2606,9 +2120,7 @@
 #endif
 			}
 
-			GetWindowText(Dialog, uimsg2, sizeof(uimsg2));
-			get_lang_msg("DLG_ABOUT_TITLE", uimsg, sizeof(uimsg), uimsg2, UILanguageFile);
-			SetWindowText(Dialog, uimsg);
+			SetDlgTexts(Dialog, TextInfos, _countof(TextInfos), UILanguageFile);
 
 			// Tera Term \x96{\x91̂̃o\x81[\x83W\x83\x87\x83\x93
 			_snprintf_s(buf, sizeof(buf), _TRUNCATE, "Version %d.%d", TT_VERSION_MAJOR, TT_VERSION_MINOR);
@@ -2619,7 +2131,7 @@
 			_snprintf_s(tmpbuf, sizeof(tmpbuf), _TRUNCATE, " (SVN# UNK)");
 			strncat_s(buf, sizeof(buf), tmpbuf, _TRUNCATE);
 #endif
-			SendMessage(GetDlgItem(Dialog, IDC_TT_VERSION), WM_SETTEXT, 0, (LPARAM)buf);
+			SetDlgItemTextA(Dialog, IDC_TT_VERSION, buf);
 
 			// Oniguruma\x82̃o\x81[\x83W\x83\x87\x83\x93\x82\xF0\x90ݒ肷\x82\xE9
 			// \x83o\x81[\x83W\x83\x87\x83\x93\x82̎擾\x82\xCD onig_version() \x82\xF0\x8CĂяo\x82\xB7\x82̂\xAA\x93K\x90؂\xBE\x82\xAA\x81A\x82\xBB\x82̂\xBD\x82߂\xBE\x82\xAF\x82Ƀ\x89\x83C\x83u\x83\x89\x83\x8A\x82\xF0
@@ -2629,7 +2141,7 @@
 			// \x83\x89\x83C\x83u\x83\x89\x83\x8A\x82\xF0\x83\x8A\x83\x93\x83N\x82\xB5\x81A\x90\xB3\x8BK\x82̎菇\x82Ńo\x81[\x83W\x83\x87\x83\x93\x82𓾂邱\x82Ƃɂ\xB5\x82\xBD\x81B
 			// (2006.7.24 yutaka)
 			_snprintf_s(buf, sizeof(buf), _TRUNCATE, "Oniguruma %s", onig_version());
-			SendMessage(GetDlgItem(Dialog, IDC_ONIGURUMA_LABEL), WM_SETTEXT, 0, (LPARAM)buf);
+			SetDlgItemTextA(Dialog, IDC_ONIGURUMA_LABEL, buf);
 
 			// \x83r\x83\x8B\x83h\x82\xB5\x82\xBD\x82Ƃ\xAB\x82Ɏg\x82\xED\x82ꂽVisual C++\x82̃o\x81[\x83W\x83\x87\x83\x93\x82\xF0\x90ݒ肷\x82\xE9\x81B(2009.3.3 yutaka)
 			_snprintf_s(buf, sizeof(buf), _TRUNCATE, "Built using Microsoft Visual C++");
@@ -2684,7 +2196,7 @@
 			// static text \x82̃T\x83C\x83Y\x82\xF0\x95ύX (2007.4.16 maya)
 			hwnd = GetDlgItem(Dialog, IDC_AUTHOR_URL);
 			hdc = GetDC(hwnd);
-			SelectObject(hdc, DlgAboutFont);
+			SelectObject(hdc, (HFONT)SendMessage(Dialog, WM_GETFONT, 0, 0));
 			GetDlgItemText(Dialog, IDC_AUTHOR_URL, uimsg, sizeof(uimsg));
 			dwExt = GetTabbedTextExtent(hdc,uimsg,strlen(uimsg),0,NULL);
 			w = LOWORD(dwExt) + 5; // \x95\x9D\x82\xAA\x8E኱\x91\xAB\x82\xE8\x82Ȃ\xA2\x82̂ŕ␳
@@ -2697,7 +2209,7 @@
 
 			hwnd = GetDlgItem(Dialog, IDC_FORUM_URL);
 			hdc = GetDC(hwnd);
-			SelectObject(hdc, DlgAboutFont);
+			SelectObject(hdc, (HFONT)SendMessage(Dialog, WM_GETFONT, 0, 0));
 			GetDlgItemText(Dialog, IDC_FORUM_URL, uimsg, sizeof(uimsg));
 			dwExt = GetTabbedTextExtent(hdc,uimsg,strlen(uimsg),0,NULL);
 			w = LOWORD(dwExt) + 5; // \x95\x9D\x82\xAA\x8E኱\x91\xAB\x82\xE8\x82Ȃ\xA2\x82̂ŕ␳
@@ -2803,9 +2315,6 @@
 					return TRUE;
 			}
 #endif
-			if (DlgAboutFont != NULL) {
-				DeleteObject(DlgAboutFont);
-			}
 			break;
 
 #if defined(EFFECT_ENABLED) || defined(TEXTURE_ENABLED)
@@ -2991,65 +2500,34 @@
 	return (n + 1);  // 1origin
 }
 
-BOOL CALLBACK GenDlg(HWND Dialog, UINT Message, WPARAM wParam, LPARAM lParam)
+static BOOL CALLBACK GenDlg(HWND Dialog, UINT Message, WPARAM wParam, LPARAM lParam)
 {
+	static const DlgTextInfo TextInfos[] = {
+		{ 0, "DLG_GEN_TITLE" },
+		{ IDC_GENPORT_LABEL, "DLG_GEN_PORT" },
+		{ IDC_GENLANGLABEL, "DLG_GEN_LANG" },
+		{ IDC_GENLANGUI_LABEL, "DLG_GEN_LANG_UI" },
+		{ IDOK, "BTN_OK" },
+		{ IDCANCEL, "BTN_CANCEL" },
+		{ IDC_GENHELP, "BTN_HELP" },
+	};
 	static int langui_sel = 1, uilist_count = 0;
 	PTTSet ts;
 	WORD w;
-	char Temp[8];
-	char uimsg[MAX_UIMSG], uimsg2[MAX_UIMSG];
-	LOGFONT logfont;
-	HFONT font;
 
 	switch (Message) {
 		case WM_INITDIALOG:
 			ts = (PTTSet)lParam;
-			SetWindowLong(Dialog, DWL_USER, lParam);
+			SetWindowLongPtr(Dialog, DWLP_USER, lParam);
 
-			font = (HFONT)SendMessage(Dialog, WM_GETFONT, 0, 0);
-			GetObject(font, sizeof(LOGFONT), &logfont);
-			if (get_lang_font("DLG_SYSTEM_FONT", Dialog, &logfont, &DlgGenFont, UILanguageFile)) {
-				SendDlgItemMessage(Dialog, IDC_GENPORT_LABEL, WM_SETFONT, (WPARAM)DlgGenFont, MAKELPARAM(TRUE,0));
-				SendDlgItemMessage(Dialog, IDC_GENPORT, WM_SETFONT, (WPARAM)DlgGenFont, MAKELPARAM(TRUE,0));
-				SendDlgItemMessage(Dialog, IDC_GENLANGLABEL, WM_SETFONT, (WPARAM)DlgGenFont, MAKELPARAM(TRUE,0));
-				SendDlgItemMessage(Dialog, IDC_GENLANG, WM_SETFONT, (WPARAM)DlgGenFont, MAKELPARAM(TRUE,0));
-				SendDlgItemMessage(Dialog, IDC_GENLANGUI_LABEL, WM_SETFONT, (WPARAM)DlgGenFont, MAKELPARAM(TRUE,0));
-				SendDlgItemMessage(Dialog, IDC_GENLANG_UI, WM_SETFONT, (WPARAM)DlgGenFont, MAKELPARAM(TRUE,0));
-				SendDlgItemMessage(Dialog, IDOK, WM_SETFONT, (WPARAM)DlgGenFont, MAKELPARAM(TRUE,0));
-				SendDlgItemMessage(Dialog, IDCANCEL, WM_SETFONT, (WPARAM)DlgGenFont, MAKELPARAM(TRUE,0));
-				SendDlgItemMessage(Dialog, IDC_GENHELP, WM_SETFONT, (WPARAM)DlgGenFont, MAKELPARAM(TRUE,0));
-			}
-			else {
-				DlgGenFont = NULL;
-			}
-
-			GetWindowText(Dialog, uimsg2, sizeof(uimsg2));
-			get_lang_msg("DLG_GEN_TITLE", uimsg, sizeof(uimsg), uimsg2, UILanguageFile);
-			SetWindowText(Dialog, uimsg);
-			GetDlgItemText(Dialog, IDC_GENPORT_LABEL, uimsg2, sizeof(uimsg2));
-			get_lang_msg("DLG_GEN_PORT", uimsg, sizeof(uimsg), uimsg2, UILanguageFile);
-			SetDlgItemText(Dialog, IDC_GENPORT_LABEL, uimsg);
-			GetDlgItemText(Dialog, IDC_GENLANGLABEL, uimsg2, sizeof(uimsg2));
-			get_lang_msg("DLG_GEN_LANG", uimsg, sizeof(uimsg), uimsg2, UILanguageFile);
-			SetDlgItemText(Dialog, IDC_GENLANGLABEL, uimsg);
-			GetDlgItemText(Dialog, IDC_GENLANGUI_LABEL, uimsg2, sizeof(uimsg2));
-			get_lang_msg("DLG_GEN_LANG_UI", uimsg, sizeof(uimsg), uimsg2, UILanguageFile);
-			SetDlgItemText(Dialog, IDC_GENLANGUI_LABEL, uimsg);
-			GetDlgItemText(Dialog, IDOK, uimsg2, sizeof(uimsg2));
-			get_lang_msg("BTN_OK", uimsg, sizeof(uimsg), uimsg2, UILanguageFile);
-			SetDlgItemText(Dialog, IDOK, uimsg);
-			GetDlgItemText(Dialog, IDCANCEL, uimsg2, sizeof(uimsg2));
-			get_lang_msg("BTN_CANCEL", uimsg, sizeof(uimsg), uimsg2, UILanguageFile);
-			SetDlgItemText(Dialog, IDCANCEL, uimsg);
-			GetDlgItemText(Dialog, IDC_GENHELP, uimsg2, sizeof(uimsg2));
-			get_lang_msg("BTN_HELP", uimsg, sizeof(uimsg), uimsg2, UILanguageFile);
-			SetDlgItemText(Dialog, IDC_GENHELP, uimsg);
-
-			SendDlgItemMessage(Dialog, IDC_GENPORT, CB_ADDSTRING,
+			SetDlgTexts(Dialog, TextInfos, _countof(TextInfos), UILanguageFile);
+		
+			SendDlgItemMessageA(Dialog, IDC_GENPORT, CB_ADDSTRING,
 			                   0, (LPARAM)"TCP/IP");
 			for (w=1;w<=ts->MaxComPort;w++) {
+				char Temp[8];
 				_snprintf_s(Temp, sizeof(Temp), _TRUNCATE, "COM%d", w);
-				SendDlgItemMessage(Dialog, IDC_GENPORT, CB_ADDSTRING,
+				SendDlgItemMessageA(Dialog, IDC_GENPORT, CB_ADDSTRING,
 				                   0, (LPARAM)Temp);
 			}
 			if (ts->PortType==IdSerial) {
@@ -3134,16 +2612,10 @@
 					PostMessage(GetParent(Dialog),WM_USER_CHANGEMENU,0,0);
 
 					EndDialog(Dialog, 1);
-					if (DlgGenFont != NULL) {
-						DeleteObject(DlgGenFont);
-					}
 					return TRUE;
 
 				case IDCANCEL:
 					EndDialog(Dialog, 0);
-					if (DlgGenFont != NULL) {
-						DeleteObject(DlgGenFont);
-					}
 					return TRUE;
 
 				case IDC_GENHELP:
@@ -3158,53 +2630,27 @@
 	return FALSE;
 }
 
-BOOL CALLBACK WinListDlg(HWND Dialog, UINT Message, WPARAM wParam, LPARAM lParam)
+static BOOL CALLBACK WinListDlg(HWND Dialog, UINT Message, WPARAM wParam, LPARAM lParam)
 {
+	static const DlgTextInfo TextInfos[] = {
+		{ 0, "DLG_WINLIST_TITLE" },
+		{ IDC_WINLISTLABEL, "DLG_WINLIST_LABEL" },
+		{ IDOK, "DLG_WINLIST_OPEN" },
+		{ IDCANCEL, "BTN_CANCEL" },
+		{ IDC_WINLISTCLOSE, "DLG_WINLIST_CLOSEWIN" },
+		{ IDC_WINLISTHELP, "BTN_HELP" },
+	};
 	PBOOL Close;
 	int n;
 	HWND Hw;
-	char uimsg[MAX_UIMSG], uimsg2[MAX_UIMSG];
-	LOGFONT logfont;
-	HFONT font;
 
 	switch (Message) {
 		case WM_INITDIALOG:
 			Close = (PBOOL)lParam;
-			SetWindowLong(Dialog, DWL_USER, lParam);
+			SetWindowLongPtr(Dialog, DWLP_USER, lParam);
 
-			font = (HFONT)SendMessage(Dialog, WM_GETFONT, 0, 0);
-			GetObject(font, sizeof(LOGFONT), &logfont);
-			if (get_lang_font("DLG_SYSTEM_FONT", Dialog, &logfont, &DlgWinlistFont, UILanguageFile)) {
-				SendDlgItemMessage(Dialog, IDC_WINLISTLABEL, WM_SETFONT, (WPARAM)DlgWinlistFont, MAKELPARAM(TRUE,0));
-				SendDlgItemMessage(Dialog, IDC_WINLISTLIST, WM_SETFONT, (WPARAM)DlgWinlistFont, MAKELPARAM(TRUE,0));
-				SendDlgItemMessage(Dialog, IDOK, WM_SETFONT, (WPARAM)DlgWinlistFont, MAKELPARAM(TRUE,0));
-				SendDlgItemMessage(Dialog, IDCANCEL, WM_SETFONT, (WPARAM)DlgWinlistFont, MAKELPARAM(TRUE,0));
-				SendDlgItemMessage(Dialog, IDC_WINLISTCLOSE, WM_SETFONT, (WPARAM)DlgWinlistFont, MAKELPARAM(TRUE,0));
-				SendDlgItemMessage(Dialog, IDC_WINLISTHELP, WM_SETFONT, (WPARAM)DlgWinlistFont, MAKELPARAM(TRUE,0));
-			}
-			else {
-				DlgWinlistFont = NULL;
-			}
-
-			GetWindowText(Dialog, uimsg2, sizeof(uimsg2));
-			get_lang_msg("DLG_WINLIST_TITLE", uimsg, sizeof(uimsg), uimsg2, UILanguageFile);
-			SetWindowText(Dialog, uimsg);
-			GetDlgItemText(Dialog, IDC_WINLISTLABEL, uimsg2, sizeof(uimsg2));
-			get_lang_msg("DLG_WINLIST_LABEL", uimsg, sizeof(uimsg), uimsg2, UILanguageFile);
-			SetDlgItemText(Dialog, IDC_WINLISTLABEL, uimsg);
-			GetDlgItemText(Dialog, IDOK, uimsg2, sizeof(uimsg2));
-			get_lang_msg("DLG_WINLIST_OPEN", uimsg, sizeof(uimsg), uimsg2, UILanguageFile);
-			SetDlgItemText(Dialog, IDOK, uimsg);
-			GetDlgItemText(Dialog, IDCANCEL, uimsg2, sizeof(uimsg2));
-			get_lang_msg("BTN_CANCEL", uimsg, sizeof(uimsg), uimsg2, UILanguageFile);
-			SetDlgItemText(Dialog, IDCANCEL, uimsg);
-			GetDlgItemText(Dialog, IDC_WINLISTCLOSE, uimsg2, sizeof(uimsg2));
-			get_lang_msg("DLG_WINLIST_CLOSEWIN", uimsg, sizeof(uimsg), uimsg2, UILanguageFile);
-			SetDlgItemText(Dialog, IDC_WINLISTCLOSE, uimsg);
-			GetDlgItemText(Dialog, IDC_WINLISTHELP, uimsg2, sizeof(uimsg2));
-			get_lang_msg("BTN_HELP", uimsg, sizeof(uimsg), uimsg2, UILanguageFile);
-			SetDlgItemText(Dialog, IDC_WINLISTHELP, uimsg);
-
+			SetDlgTexts(Dialog, TextInfos, _countof(TextInfos), UILanguageFile);
+		
 			SetWinList(GetParent(Dialog),Dialog,IDC_WINLISTLIST);
 			return TRUE;
 
@@ -3217,16 +2663,10 @@
 						SelectWin(n);
 					}
 					EndDialog(Dialog, 1);
-					if (DlgWinlistFont != NULL) {
-						DeleteObject(DlgWinlistFont);
-					}
 					return TRUE;
 
 				case IDCANCEL:
 					EndDialog(Dialog, 0);
-					if (DlgWinlistFont != NULL) {
-						DeleteObject(DlgWinlistFont);
-					}
 					return TRUE;
 
 				case IDC_WINLISTLIST:
@@ -3250,9 +2690,6 @@
 						SendDlgItemMessage(Dialog,IDC_WINLISTLIST,
 						                   LB_DELETESTRING,n,0);
 						PostMessage(Hw,WM_SYSCOMMAND,SC_CLOSE,0);
-						if (DlgWinlistFont != NULL) {
-							DeleteObject(DlgWinlistFont);
-						}
 					}
 					else {
 						Close = (PBOOL)GetWindowLong(Dialog,DWL_USER);
@@ -3260,9 +2697,6 @@
 							*Close = TRUE;
 						}
 						EndDialog(Dialog, 1);
-						if (DlgWinlistFont != NULL) {
-							DeleteObject(DlgWinlistFont);
-						}
 						return TRUE;
 					}
 					break;
@@ -3274,7 +2708,7 @@
 	return FALSE;
 }
 
-BOOL WINAPI SetupTerminal(HWND WndParent, PTTSet ts)
+BOOL WINAPI _SetupTerminal(HWND WndParent, PTTSet ts)
 {
 	int i;
 
@@ -3299,7 +2733,7 @@
 		                     WndParent, TermDlg, (LPARAM)ts);
 }
 
-BOOL WINAPI SetupWin(HWND WndParent, PTTSet ts)
+BOOL WINAPI _SetupWin(HWND WndParent, PTTSet ts)
 {
 	return
 		(BOOL)DialogBoxParam(hInst,
@@ -3307,7 +2741,7 @@
 		                     WndParent, WinDlg, (LPARAM)ts);
 }
 
-BOOL WINAPI SetupKeyboard(HWND WndParent, PTTSet ts)
+BOOL WINAPI _SetupKeyboard(HWND WndParent, PTTSet ts)
 {
 	return
 		(BOOL)DialogBoxParam(hInst,
@@ -3315,7 +2749,7 @@
 		                     WndParent, KeybDlg, (LPARAM)ts);
 }
 
-BOOL WINAPI SetupSerialPort(HWND WndParent, PTTSet ts)
+BOOL WINAPI _SetupSerialPort(HWND WndParent, PTTSet ts)
 {
 	return
 		(BOOL)DialogBoxParam(hInst,
@@ -3323,7 +2757,7 @@
 		                     WndParent, SerialDlg, (LPARAM)ts);
 }
 
-BOOL WINAPI SetupTCPIP(HWND WndParent, PTTSet ts)
+BOOL WINAPI _SetupTCPIP(HWND WndParent, PTTSet ts)
 {
 	return
 		(BOOL)DialogBoxParam(hInst,
@@ -3331,7 +2765,7 @@
 		                     WndParent, TCPIPDlg, (LPARAM)ts);
 }
 
-BOOL WINAPI GetHostName(HWND WndParent, PGetHNRec GetHNRec)
+BOOL WINAPI _GetHostName(HWND WndParent, PGetHNRec GetHNRec)
 {
 	return
 		(BOOL)DialogBoxParam(hInst,
@@ -3339,7 +2773,7 @@
 		                     WndParent, HostDlg, (LPARAM)GetHNRec);
 }
 
-BOOL WINAPI ChangeDirectory(HWND WndParent, PCHAR CurDir)
+BOOL WINAPI _ChangeDirectory(HWND WndParent, PCHAR CurDir)
 {
 	return
 		(BOOL)DialogBoxParam(hInst,
@@ -3347,7 +2781,7 @@
 		                     WndParent, DirDlg, (LPARAM)CurDir);
 }
 
-BOOL WINAPI AboutDialog(HWND WndParent)
+BOOL WINAPI _AboutDialog(HWND WndParent)
 {
 	return
 		(BOOL)DialogBox(hInst,
@@ -3400,7 +2834,7 @@
 #ifndef CF_INACTIVEFONTS
 #define CF_INACTIVEFONTS 0x02000000L
 #endif
-BOOL WINAPI ChooseFontDlg(HWND WndParent, LPLOGFONT LogFont, PTTSet ts)
+BOOL WINAPI _ChooseFontDlg(HWND WndParent, LPLOGFONTA LogFont, PTTSet ts)
 {
 	CHOOSEFONT cf;
 	BOOL Ok;
@@ -3423,7 +2857,7 @@
 	return Ok;
 }
 
-BOOL WINAPI SetupGeneral(HWND WndParent, PTTSet ts)
+BOOL WINAPI _SetupGeneral(HWND WndParent, PTTSet ts)
 {
 	return
 		(BOOL)DialogBoxParam(hInst,
@@ -3431,7 +2865,7 @@
 		                     WndParent, (DLGPROC)&GenDlg, (LPARAM)ts);
 }
 
-BOOL WINAPI WindowWindow(HWND WndParent, PBOOL Close)
+BOOL WINAPI _WindowWindow(HWND WndParent, PBOOL Close)
 {
 	*Close = FALSE;
 	return
@@ -3441,11 +2875,13 @@
 		                     (DLGPROC)&WinListDlg, (LPARAM)Close);
 }
 
-void WINAPI TTDLGSetUILanguageFile(char *file)
+BOOL WINAPI _TTDLGSetUILanguageFile(char *file)
 {
 	strncpy_s(UILanguageFile, sizeof(UILanguageFile), file, _TRUNCATE);
+	return TRUE;
 }
 
+#if 0
 BOOL WINAPI DllMain(HANDLE hInstance,
                     ULONG ul_reason_for_call,
                     LPVOID lpReserved)
@@ -3468,3 +2904,4 @@
 	}
 	return TRUE;
 }
+#endif

Added: trunk/teraterm/ttpdlg/ttdlg.h
===================================================================
--- trunk/teraterm/ttpdlg/ttdlg.h	                        (rev 0)
+++ trunk/teraterm/ttpdlg/ttdlg.h	2019-03-26 15:42:43 UTC (rev 7515)
@@ -0,0 +1,43 @@
+/*
+ * (C) 2018-2019 TeraTerm Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "teraterm.h"
+#include "tttypes.h"
+
+BOOL WINAPI _SetupTerminal(HWND WndParent, PTTSet ts);
+BOOL WINAPI _SetupWin(HWND WndParent, PTTSet ts);
+BOOL WINAPI _SetupKeyboard(HWND WndParent, PTTSet ts);
+BOOL WINAPI _SetupSerialPort(HWND WndParent, PTTSet ts);
+BOOL WINAPI _SetupTCPIP(HWND WndParent, PTTSet ts);
+BOOL WINAPI _GetHostName(HWND WndParent, PGetHNRec GetHNRec);
+BOOL WINAPI _ChangeDirectory(HWND WndParent, PCHAR CurDir);
+BOOL WINAPI _AboutDialog(HWND WndParent);
+BOOL WINAPI _ChooseFontDlg(HWND WndParent, LPLOGFONTA LogFont, PTTSet ts);
+BOOL WINAPI _SetupGeneral(HWND WndParent, PTTSet ts);
+BOOL WINAPI _WindowWindow(HWND WndParent, PBOOL Close);
+BOOL WINAPI _TTDLGSetUILanguageFile(char *file);

Deleted: trunk/teraterm/ttpdlg/ttpdlg-version.rc
===================================================================
--- trunk/teraterm/ttpdlg/ttpdlg-version.rc	2019-03-26 15:42:29 UTC (rev 7514)
+++ trunk/teraterm/ttpdlg/ttpdlg-version.rc	2019-03-26 15:42:43 UTC (rev 7515)
@@ -1,39 +0,0 @@
-/////////////////////////////////////////////////////////////////////////////
-//
-// Version
-//
-
-#include "tt-version.h"
-
-VS_VERSION_INFO VERSIONINFO
- FILEVERSION TT_VERSION_MAJOR,TT_VERSION_MINOR,0,0
- PRODUCTVERSION TT_VERSION_MAJOR,TT_VERSION_MINOR,0,0
- FILEFLAGSMASK 0x3fL
-#ifdef _DEBUG
- FILEFLAGS 0x1L
-#else
- FILEFLAGS 0x0L
-#endif
- FILEOS 0x4L
- FILETYPE 0x2L
- FILESUBTYPE 0x0L
-BEGIN
-    BLOCK "StringFileInfo"
-    BEGIN
-        BLOCK "040904b0"
-        BEGIN
-            VALUE "CompanyName", "T. Teranishi, TeraTerm Project"
-            VALUE "FileDescription", "Tera Term Dialog Routines"
-            VALUE "FileVersion", TT_RES_VERSION_STR
-            VALUE "InternalName", "TTPDLG"
-            VALUE "LegalCopyright", "Copyright (C) 1994-1998 T. Teranishi, (C) 2004-2019 TeraTerm Project"
-            VALUE "OriginalFilename", "TTPDLG.dll"
-            VALUE "ProductName", "Tera Term"
-            VALUE "ProductVersion", TT_RES_VERSION_STR
-        END
-    END
-    BLOCK "VarFileInfo"
-    BEGIN
-        VALUE "Translation", 0x409, 1200
-    END
-END

Modified: trunk/teraterm/ttpdlg/ttpdlg.rc
===================================================================
--- trunk/teraterm/ttpdlg/ttpdlg.rc	2019-03-26 15:42:29 UTC (rev 7514)
+++ trunk/teraterm/ttpdlg/ttpdlg.rc	2019-03-26 15:42:43 UTC (rev 7515)
@@ -42,7 +42,6 @@
 
 3 TEXTINCLUDE 
 BEGIN
-    "#include ""ttpdlg-version.rc""\r\n"
     "\0"
 END
 
@@ -413,7 +412,6 @@
     IDD_ABOUTDLG, DIALOG
     BEGIN
         RIGHTMARGIN, 186
-        BOTTOMMARGIN, 125
     END
 
     IDD_GENDLG, DIALOG
@@ -436,27 +434,7 @@
 END
 #endif    // APSTUDIO_INVOKED
 
-
-/////////////////////////////////////////////////////////////////////////////
-//
-// Icon
-//
-
-// Icon with lowest ID value placed first to ensure application icon
-// remains consistent on all systems.
-IDI_TTERM               ICON                    "..\\common\\teraterm.ico"
 #endif    // \x89p\x8C\xEA (\x95č\x91) resources
 /////////////////////////////////////////////////////////////////////////////
 
 
-
-#ifndef APSTUDIO_INVOKED
-/////////////////////////////////////////////////////////////////////////////
-//
-// Generated from the TEXTINCLUDE 3 resource.
-//
-#include "ttpdlg-version.rc"
-
-/////////////////////////////////////////////////////////////////////////////
-#endif    // not APSTUDIO_INVOKED
-


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