[Ttssh2-commit] [7263] teraterm/teraterm,teraterm/ttpdlgをunicode化

scmno****@osdn***** scmno****@osdn*****
2018年 11月 18日 (日) 00:43:21 JST


Revision: 7263
          http://sourceforge.jp/projects/ttssh2/scm/svn/commits/7263
Author:   zmatsuo
Date:     2018-11-18 00:43:21 +0900 (Sun, 18 Nov 2018)
Log Message:
-----------
teraterm/teraterm,teraterm/ttpdlgをunicode化

- ダイアログ、メニューなど、表示周りをunicode化
- 内部文字コードは変更せず

Modified Paths:
--------------
    branches/cmake/teraterm/common/compat_win.cpp
    branches/cmake/teraterm/common/dlglib.c
    branches/cmake/teraterm/common/dlglib.h
    branches/cmake/teraterm/common/dlglib_tmpl.cpp
    branches/cmake/teraterm/common/i18n.c
    branches/cmake/teraterm/common/i18n.h
    branches/cmake/teraterm/common/tektypes.h
    branches/cmake/teraterm/common/tmfc.cpp
    branches/cmake/teraterm/common/tmfc.h
    branches/cmake/teraterm/common/tmfc_frame.cpp
    branches/cmake/teraterm/common/ttlib.c
    branches/cmake/teraterm/common/ttlib.h
    branches/cmake/teraterm/teraterm/CMakeLists.txt
    branches/cmake/teraterm/teraterm/addsetting.cpp
    branches/cmake/teraterm/teraterm/addsetting.h
    branches/cmake/teraterm/teraterm/buffer.c
    branches/cmake/teraterm/teraterm/commlib.c
    branches/cmake/teraterm/teraterm/dnddlg.cpp
    branches/cmake/teraterm/teraterm/dnddlg.h
    branches/cmake/teraterm/teraterm/filesys.cpp
    branches/cmake/teraterm/teraterm/ftdlg.cpp
    branches/cmake/teraterm/teraterm/sizetip.c
    branches/cmake/teraterm/teraterm/tekwin.cpp
    branches/cmake/teraterm/teraterm/teraprn.cpp
    branches/cmake/teraterm/teraterm/teraterm.cpp
    branches/cmake/teraterm/teraterm/ttdde.c
    branches/cmake/teraterm/teraterm/ttdialog.c
    branches/cmake/teraterm/teraterm/ttdialog.h
    branches/cmake/teraterm/teraterm/ttime.c
    branches/cmake/teraterm/teraterm/ttime.h
    branches/cmake/teraterm/teraterm/ttplug.c
    branches/cmake/teraterm/teraterm/ttwinman.c
    branches/cmake/teraterm/teraterm/ttwsk.c
    branches/cmake/teraterm/teraterm/vtdisp.c
    branches/cmake/teraterm/teraterm/vtwin.cpp
    branches/cmake/teraterm/teraterm/vtwin.h
    branches/cmake/teraterm/teraterm/winjump.c
    branches/cmake/teraterm/ttpdlg/ttdlg.c
    branches/cmake/teraterm/ttpdlg/ttdlg.h
    branches/cmake/teraterm/ttpdlg/ttpdlg.rc

-------------- next part --------------
Modified: branches/cmake/teraterm/common/compat_win.cpp
===================================================================
--- branches/cmake/teraterm/common/compat_win.cpp	2018-11-17 15:43:03 UTC (rev 7262)
+++ branches/cmake/teraterm/common/compat_win.cpp	2018-11-17 15:43:21 UTC (rev 7263)
@@ -1,95 +1,95 @@
-/*
- * (C) 2018 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.
- */
-
-/* compat_win */
-
-#include "compat_win.h"
-
-HINSTANCE hDll_msimg32;
-HMODULE hDll_user32;
-
-BOOL (WINAPI *pAlphaBlend)(HDC,int,int,int,int,HDC,int,int,int,int,BLENDFUNCTION);
-BOOL (WINAPI *pEnumDisplayMonitors)(HDC,LPCRECT,MONITORENUMPROC,LPARAM);
-DPI_AWARENESS_CONTEXT (WINAPI *pSetThreadDpiAwarenessContext)(DPI_AWARENESS_CONTEXT dpiContext);
-UINT (WINAPI *pGetDpiForWindow)(HWND hwnd);
-BOOL (WINAPI *pSetLayeredWindowAttributes)(HWND hwnd, COLORREF crKey, BYTE bAlpha, DWORD dwFlags);
-
-typedef struct {
-	const char *ApiName;
-	void **func;
-} APIInfo;
-
-typedef struct {
-	const char *DllName;
-	HINSTANCE *hDll;
-	const APIInfo *APIInfoPtr;
-	size_t APIInfoCount;
-} DllInfo;
-
-static const APIInfo Lists_user32[] = {
-	{ "SetLayeredWindowAttributes", (void **)&pSetLayeredWindowAttributes },
-	{ "SetThreadDpiAwarenessContext", (void **)&pSetThreadDpiAwarenessContext },
-	{ "GetDpiForWindow", (void **)&pGetDpiForWindow }
-};
-	
-static const APIInfo Lists_msimg32[] = {
-	{ "AlphaBlend", (void **)&pAlphaBlend },
-};
-	
-static const DllInfo DllInfos[] = {
-	{ "user32.dll", &hDll_user32, Lists_user32, _countof(Lists_user32) },
-	{ "msimg32.dll", &hDll_msimg32, Lists_msimg32, _countof(Lists_msimg32) },
-};
-
-void WinCompatInit()
-{
-	static BOOL done = FALSE;
-	if (done) return;
-	done = TRUE;
-
-	for (size_t i = 0; i < _countof(DllInfos); i++) {
-		const DllInfo *pDllInfo = &DllInfos[i];
-
-		char dllName[MAX_PATH];
-		GetSystemDirectory(dllName, sizeof(dllName));
-		strcat_s(dllName, sizeof(dllName), "/");
-		strcat_s(dllName, sizeof(dllName), pDllInfo->DllName);
-
-		HINSTANCE hDll = LoadLibrary(dllName);
-		*pDllInfo->hDll = hDll;
-
-		if (hDll != NULL) {
-			const APIInfo *pApiInfo = pDllInfo->APIInfoPtr;
-			for (size_t j = 0; j < pDllInfo->APIInfoCount; j++) {
-				void **func = pApiInfo->func;
-				*func = (void *)GetProcAddress(hDll, pApiInfo->ApiName);
-				pApiInfo++;
-			}
-		}
-	}
-}
+/*
+ * (C) 2018 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.
+ */
+
+/* compat_win */
+
+#include "compat_win.h"
+
+HINSTANCE hDll_msimg32;
+HMODULE hDll_user32;
+
+BOOL (WINAPI *pAlphaBlend)(HDC,int,int,int,int,HDC,int,int,int,int,BLENDFUNCTION);
+BOOL (WINAPI *pEnumDisplayMonitors)(HDC,LPCRECT,MONITORENUMPROC,LPARAM);
+DPI_AWARENESS_CONTEXT (WINAPI *pSetThreadDpiAwarenessContext)(DPI_AWARENESS_CONTEXT dpiContext);
+UINT (WINAPI *pGetDpiForWindow)(HWND hwnd);
+BOOL (WINAPI *pSetLayeredWindowAttributes)(HWND hwnd, COLORREF crKey, BYTE bAlpha, DWORD dwFlags);
+
+typedef struct {
+	const char *ApiName;
+	void **func;
+} APIInfo;
+
+typedef struct {
+	const char *DllName;
+	HINSTANCE *hDll;
+	const APIInfo *APIInfoPtr;
+	size_t APIInfoCount;
+} DllInfo;
+
+static const APIInfo Lists_user32[] = {
+	{ "SetLayeredWindowAttributes", (void **)&pSetLayeredWindowAttributes },
+	{ "SetThreadDpiAwarenessContext", (void **)&pSetThreadDpiAwarenessContext },
+	{ "GetDpiForWindow", (void **)&pGetDpiForWindow }
+};
+	
+static const APIInfo Lists_msimg32[] = {
+	{ "AlphaBlend", (void **)&pAlphaBlend },
+};
+	
+static const DllInfo DllInfos[] = {
+	{ "user32.dll", &hDll_user32, Lists_user32, _countof(Lists_user32) },
+	{ "msimg32.dll", &hDll_msimg32, Lists_msimg32, _countof(Lists_msimg32) },
+};
+
+void WinCompatInit()
+{
+	static BOOL done = FALSE;
+	if (done) return;
+	done = TRUE;
+
+	for (size_t i = 0; i < _countof(DllInfos); i++) {
+		const DllInfo *pDllInfo = &DllInfos[i];
+
+		char dllName[MAX_PATH];
+		GetSystemDirectoryA(dllName, sizeof(dllName));
+		strcat_s(dllName, sizeof(dllName), "/");
+		strcat_s(dllName, sizeof(dllName), pDllInfo->DllName);
+
+		HINSTANCE hDll = LoadLibraryA(dllName);
+		*pDllInfo->hDll = hDll;
+
+		if (hDll != NULL) {
+			const APIInfo *pApiInfo = pDllInfo->APIInfoPtr;
+			for (size_t j = 0; j < pDllInfo->APIInfoCount; j++) {
+				void **func = pApiInfo->func;
+				*func = (void *)GetProcAddress(hDll, pApiInfo->ApiName);
+				pApiInfo++;
+			}
+		}
+	}
+}

Modified: branches/cmake/teraterm/common/dlglib.c
===================================================================
--- branches/cmake/teraterm/common/dlglib.c	2018-11-17 15:43:03 UTC (rev 7262)
+++ branches/cmake/teraterm/common/dlglib.c	2018-11-17 15:43:21 UTC (rev 7263)
@@ -35,6 +35,7 @@
 #include <assert.h>
 #include <stdio.h>
 #include <commctrl.h>
+#include <tchar.h>
 
 void EnableDlgItem(HWND HDlg, int FirstId, int LastId)
 {
@@ -101,10 +102,10 @@
 
 void SetDlgNum(HWND HDlg, int id_Item, LONG Num)
 {
-	char Temp[16];
+	TCHAR Temp[16];
 
 	/* In Win16, SetDlgItemInt can not be used to display long integer. */
-	_snprintf_s(Temp,sizeof(Temp),_TRUNCATE,"%d",Num);
+	_sntprintf_s(Temp, _countof(Temp), _TRUNCATE, _T("%d"), Num);
 	SetDlgItemText(HDlg,id_Item,Temp);
 }
 
@@ -128,7 +129,7 @@
 	// \x97\x8E\x82\xBF\x82\xE9\x96\xE2\x91\xE8\x82ւ̑Ώ\x88\x81B(2005.3.18 yutaka)
 	// cf. http://sourceforge.jp/tracker/index.php?func=detail&aid=5713&group_id=1412&atid=5333
 	double Num; 
-	char NumStr[10]; 
+	TCHAR NumStr[10]; 
 
 	if (b==0) {
 		Num = 100.0; 
@@ -136,7 +137,7 @@
 	else {
 		Num = 100.0 * (double)a / (double)b; 
 	}
-	_snprintf_s(NumStr,sizeof(NumStr),_TRUNCATE,"%3.1f%%",Num); 
+	_sntprintf_s(NumStr, _countof(NumStr),_TRUNCATE,_T("%3.1f%%"),Num); 
 	SetDlgItemText(HDlg, id_Item, NumStr); 
 
 	if (id_Progress != 0 && p != NULL && *p >= 0 && (double)*p < Num) {
@@ -149,13 +150,13 @@
 {
 	static int prev_elapsed;
 	int elapsed, rate;
-	char buff[64];
+	TCHAR buff[64];
 
 	elapsed = (GetTickCount() - stime) / 1000;
 
 	if (elapsed == 0) {
 		prev_elapsed = 0;
-		SetDlgItemText(HDlg, id_Item, "0:00");
+		SetDlgItemText(HDlg, id_Item, _T("0:00"));
 		return;
 	}
 
@@ -166,25 +167,25 @@
 
 	rate = bytes / elapsed;
 	if (rate < 1200) {
-		_snprintf_s(buff, sizeof(buff), _TRUNCATE, "%d:%02d (%dBytes/s)", elapsed / 60, elapsed % 60, rate); 
+		_sntprintf_s(buff, _countof(buff), _TRUNCATE, _T("%d:%02d (%dBytes/s)"), elapsed / 60, elapsed % 60, rate); 
 	}
 	else if (rate < 1200000) {
-		_snprintf_s(buff, sizeof(buff), _TRUNCATE, "%d:%02d (%d.%02dKB/s)", elapsed / 60, elapsed % 60, rate / 1000, rate / 10 % 100); 
+		_sntprintf_s(buff, _countof(buff), _TRUNCATE, _T("%d:%02d (%d.%02dKB/s)"), elapsed / 60, elapsed % 60, rate / 1000, rate / 10 % 100);
 	}
 	else {
-		_snprintf_s(buff, sizeof(buff), _TRUNCATE, "%d:%02d (%d.%02dMB/s)", elapsed / 60, elapsed % 60, rate / (1000 * 1000), rate / 10000 % 100); 
+		_sntprintf_s(buff, _countof(buff), _TRUNCATE, _T("%d:%02d (%d.%02dMB/s)"), elapsed / 60, elapsed % 60, rate / (1000 * 1000), rate / 10000 % 100);
 	}
 
 	SetDlgItemText(HDlg, id_Item, buff);
 }
 
-void SetDropDownList(HWND HDlg, int Id_Item, const TCHAR *List[], int nsel)
+void SetDropDownList(HWND HDlg, int Id_Item, const char *List[], int nsel)
 {
 	int i;
 
 	i = 0;
 	while (List[i] != NULL) {
-		SendDlgItemMessage(HDlg, Id_Item, CB_ADDSTRING,
+		SendDlgItemMessageA(HDlg, Id_Item, CB_ADDSTRING,
 		                   0, (LPARAM)List[i]);
 		i++;
 	}
@@ -276,7 +277,7 @@
 						max++; // '\0'
 						orgstr = str = (char *)malloc(max);
 						if (str != NULL) {
-							len = GetWindowText(dlg, str, max);
+							len = GetWindowTextA(dlg, str, max);
 							if (select >= 0 && select < len) {
 								if (wParam == 0x44) { // \x83J\x81[\x83\\x83\x8B\x94z\x89\xBA\x82̕\xB6\x8E\x9A\x82݂̂\xF0\x8D폜\x82\xB7\x82\xE9
 									memmove(&str[select], &str[select + 1], len - select - 1);
@@ -297,7 +298,7 @@
 								select = 0;
 							}
 
-							SetWindowText(dlg, str);
+							SetWindowTextA(dlg, str);
 							SendMessage(dlg, EM_SETSEL, select, select);
 							free(orgstr);
 							return 0;
@@ -366,10 +367,9 @@
 	assert(infoCount > 0);
 	for (i = 0 ; i < infoCount; i++) {
 		const char *key = infos[i].key;
-#if 1
-		char uimsg[MAX_UIMSG];
-		get_lang_msg(key, uimsg, sizeof(uimsg), "", UILanguageFile);
-		if (uimsg[0] != '\0') {
+		TCHAR uimsg[MAX_UIMSG];
+		get_lang_msgT(key, uimsg, sizeof(uimsg), _T(""), UILanguageFile);
+		if (uimsg[0] != _T('\0')) {
 			const int nIDDlgItem = infos[i].nIDDlgItem;
 			if (nIDDlgItem == 0) {
 				SetWindowText(hDlgWnd, uimsg);
@@ -379,20 +379,23 @@
 				assert(r != 0); (void)r;
 			}
 		}
-#else
-		char uimsg_ini[MAX_UIMSG];
-		get_lang_msg(key, uimsg_ini, sizeof(uimsg_ini), "", UILanguageFile);
-		if (uimsg_ini[0] != '\0') {
-			wchar_t uimsg[MAX_UIMSG];
-			MultiByteToWideChar(932, 0, uimsg_ini, -1, uimsg, _countof(uimsg));
-			const int nIDDlgItem = infos[i].nIDDlgItem;
-			if (nIDDlgItem == 0) {
-				SetWindowTextW(hDlgWnd, uimsg);
+	}
+}
+
+void SetDlgMenuTexts(HMENU hMenu, const DlgTextInfo *infos, int infoCount, const char *UILanguageFile)
+{
+	int i;
+	for (i = 0; i < infoCount; i++) {
+		const int nIDDlgItem = infos[i].nIDDlgItem;
+		const char *key = infos[i].key;
+		TCHAR uimsg[MAX_UIMSG];
+ 		get_lang_msgT(key, uimsg, sizeof(uimsg), _T(""), UILanguageFile);
+		if (uimsg[0] != '\0') {
+			if (nIDDlgItem < 1000) {
+				ModifyMenu(hMenu, nIDDlgItem, MF_BYPOSITION, nIDDlgItem, uimsg);
 			} else {
-				SetDlgItemTextW(hDlgWnd, nIDDlgItem, uimsg);
+				ModifyMenu(hMenu, nIDDlgItem, MF_BYCOMMAND, nIDDlgItem, uimsg);
 			}
 		}
-#endif
 	}
 }
-

Modified: branches/cmake/teraterm/common/dlglib.h
===================================================================
--- branches/cmake/teraterm/common/dlglib.h	2018-11-17 15:43:03 UTC (rev 7262)
+++ branches/cmake/teraterm/common/dlglib.h	2018-11-17 15:43:21 UTC (rev 7263)
@@ -44,7 +44,7 @@
 void SetDlgNum(HWND HDlg, int id_Item, LONG Num);
 void SetDlgPercent(HWND HDlg, int id_Item, int id_Progress, LONG a, LONG b, int *prog);
 void SetDlgTime(HWND HDlg, int id_Item, DWORD elapsed, int bytes);
-void SetDropDownList(HWND HDlg, int Id_Item, const TCHAR *List[], int nsel);
+void SetDropDownList(HWND HDlg, int Id_Item, const char *List[], int nsel);
 LONG GetCurSel(HWND HDlg, int Id_Item);
 void InitDlgProgress(HWND HDlg, int id_Progress, int *CurProgStat);
 void SetEditboxSubclass(HWND hDlg, int nID, BOOL ComboBox);
@@ -55,12 +55,13 @@
 void SetDlgTexts(HWND hDlgWnd, const DlgTextInfo *infos, int infoCount, const char *UILanguageFile);
 HFONT SetDlgFonts(HWND hDlg, const int nIDDlgItems[], int nIDDlgItemCount,
 				  const char *UILanguageFile, PCHAR key);
+void SetDlgMenuTexts(HMENU hMenu, const DlgTextInfo *infos, int infoCount, const char *UILanguageFile);
 
 ////////////////////////////////////////
 void TTSetDlgFont(const char *face, int height, int charset);
 //void TTSetDlgFont(const wchar_t *face, int height, int charset);
 const wchar_t *TTGetClassName(const DLGTEMPLATE *DlgTempl);
-DLGTEMPLATE *TTGetDlgTemplate(HINSTANCE hInst, LPCSTR lpTemplateName);
+DLGTEMPLATE *TTGetDlgTemplate(HINSTANCE hInst, LPCTSTR lpTemplateName);
 DLGTEMPLATE *TTGetNewDlgTemplate(
 	HINSTANCE hInst, const DLGTEMPLATE *src,
 	size_t *PrevTemplSize, size_t *NewTemplSize);

Modified: branches/cmake/teraterm/common/dlglib_tmpl.cpp
===================================================================
--- branches/cmake/teraterm/common/dlglib_tmpl.cpp	2018-11-17 15:43:03 UTC (rev 7262)
+++ branches/cmake/teraterm/common/dlglib_tmpl.cpp	2018-11-17 15:43:21 UTC (rev 7263)
@@ -417,7 +417,7 @@
 }
 
 static DLGTEMPLATE *GetDlgTemplate(
-	HINSTANCE hInst, LPCSTR lpTemplateName,
+	HINSTANCE hInst, LPCTSTR lpTemplateName,
 	const WCHAR *FontFaceName, LONG FontHeight, BYTE FontCharSet,
 	size_t *PrevTemplSize, size_t *NewTemplSize)
 {
@@ -475,7 +475,7 @@
 	return DlgTemplate;
 }
 
-DLGTEMPLATE *TTGetDlgTemplate(HINSTANCE hInst, LPCSTR lpTemplateName)
+DLGTEMPLATE *TTGetDlgTemplate(HINSTANCE hInst, LPCTSTR lpTemplateName)
 {
 	DLGTEMPLATE *DlgTemplate =
 		GetDlgTemplate(hInst, lpTemplateName,

Modified: branches/cmake/teraterm/common/i18n.c
===================================================================
--- branches/cmake/teraterm/common/i18n.c	2018-11-17 15:43:03 UTC (rev 7262)
+++ branches/cmake/teraterm/common/i18n.c	2018-11-17 15:43:21 UTC (rev 7263)
@@ -28,18 +28,37 @@
 
 #include "i18n.h"
 
+#include <assert.h>
+
+DllExport void GetI18nStrT(const char *section, const char *key, PCHAR buf, int buf_len, const char *def, const char *iniFile)
+{
+	assert(FALSE);
+}
+
+DllExport void GetI18nStrW(const char *section, const char *key, wchar_t *buf, int buf_len, const wchar_t *def, const char *iniFile)
+{
+	wchar_t sectionW[64];
+	wchar_t keyW[128];
+	wchar_t iniFileW[MAX_PATH];
+	MultiByteToWideChar(CP_ACP, 0, section, -1, sectionW, _countof(sectionW));
+	MultiByteToWideChar(CP_ACP, 0, key, -1, keyW, _countof(keyW));
+	MultiByteToWideChar(CP_ACP, 0, iniFile, -1, iniFileW, _countof(iniFileW));
+	GetPrivateProfileStringW(sectionW, keyW, def, buf, buf_len, iniFileW);
+	RestoreNewLineW(buf);
+}
+
 DllExport void GetI18nStr(const char *section, const char *key, PCHAR buf, int buf_len, const char *def, const char *iniFile)
 {
-	GetPrivateProfileString(section, key, def, buf, buf_len, iniFile);
+	GetPrivateProfileStringA(section, key, def, buf, buf_len, iniFile);
 	RestoreNewLine(buf);
 }
 
-DllExport int GetI18nLogfont(const char *section, const char *key, PLOGFONT logfont, int ppi, const char *iniFile)
+DllExport int GetI18nLogfont(const char *section, const char *key, PLOGFONTA logfont, int ppi, const char *iniFile)
 {
 	static char tmp[MAX_UIMSG];
 	static char font[LF_FACESIZE];
 	int hight, charset;
-	GetPrivateProfileString(section, key, "-", tmp, MAX_UIMSG, iniFile);
+	GetPrivateProfileStringA(section, key, "-", tmp, MAX_UIMSG, iniFile);
 	if (strcmp(tmp, "-") == 0) {
 		return FALSE;
 	}

Modified: branches/cmake/teraterm/common/i18n.h
===================================================================
--- branches/cmake/teraterm/common/i18n.h	2018-11-17 15:43:03 UTC (rev 7262)
+++ branches/cmake/teraterm/common/i18n.h	2018-11-17 15:43:21 UTC (rev 7263)
@@ -51,8 +51,10 @@
 #define DllExport	// direct link
 #endif
 
+DllExport void GetI18nStrT(const char *section, const char *key, PCHAR buf, int buf_len, const char *def, const char *iniFile);
+DllExport void GetI18nStrW(const char *section, const char *key, wchar_t *buf, int buf_len, const wchar_t *def, const char *iniFile);
 DllExport void GetI18nStr(const char *section, const char *key, PCHAR buf, int buf_len, const char *def, const char *iniFile);
-DllExport int GetI18nLogfont(const char *section, const char *key, PLOGFONT logfont, int ppi, const char *iniFile);
+DllExport int GetI18nLogfont(const char *section, const char *key, PLOGFONTA logfont, int ppi, const char *iniFile);
 
 #ifdef __cplusplus
 }

Modified: branches/cmake/teraterm/common/tektypes.h
===================================================================
--- branches/cmake/teraterm/common/tektypes.h	2018-11-17 15:43:03 UTC (rev 7262)
+++ branches/cmake/teraterm/common/tektypes.h	2018-11-17 15:43:21 UTC (rev 7263)
@@ -86,7 +86,7 @@
   int ParseMode;
   int SelectCodeFlag;
 
-  LOGFONT TEKlf;
+  LOGFONTA TEKlf;
   HFONT TEKFont[4];
   HFONT OldMemFont;
   BOOL AdjustSize, ScaleFont;

Modified: branches/cmake/teraterm/common/tmfc.cpp
===================================================================
--- branches/cmake/teraterm/common/tmfc.cpp	2018-11-17 15:43:03 UTC (rev 7262)
+++ branches/cmake/teraterm/common/tmfc.cpp	2018-11-17 15:43:21 UTC (rev 7263)
@@ -62,21 +62,56 @@
 	return ::GetDlgItem(m_hWnd, id);
 }
 
-LRESULT TTCWnd::SendDlgItemMessage(int id, UINT msg, WPARAM wp, LPARAM lp)
+LRESULT TTCWnd::SendDlgItemMessageT(int id, UINT msg, WPARAM wp, LPARAM lp)
 {
 	return ::SendDlgItemMessage(m_hWnd, id, msg, wp, lp);
 }
 
-void TTCWnd::GetDlgItemText(int id, TCHAR *buf, size_t size)
+LRESULT TTCWnd::SendDlgItemMessageW(int id, UINT msg, WPARAM wp, LPARAM lp)
 {
+	return ::SendDlgItemMessageW(m_hWnd, id, msg, wp, lp);
+}
+
+LRESULT TTCWnd::SendDlgItemMessageA(int id, UINT msg, WPARAM wp, LPARAM lp)
+{
+	return ::SendDlgItemMessageA(m_hWnd, id, msg, wp, lp);
+}
+
+void TTCWnd::GetDlgItemTextT(int id, TCHAR *buf, size_t size)
+{
 	::GetDlgItemText(m_hWnd, id, buf, (int)size);
 }
 
-void TTCWnd::SetDlgItemText(int id, const TCHAR *str)
+void TTCWnd::GetDlgItemTextW(int id, wchar_t *buf, size_t size)
 {
+	::GetDlgItemTextW(m_hWnd, id, buf, (int)size);
+}
+
+void TTCWnd::GetDlgItemTextA(int id, char *buf, size_t size)
+{
+	::GetDlgItemTextA(m_hWnd, id, buf, (int)size);
+}
+
+void TTCWnd::SetDlgItemTextT(int id, const TCHAR *str)
+{
 	::SetDlgItemText(m_hWnd, id, str);
 }
 
+void TTCWnd::SetDlgItemTextW(int id, const wchar_t *str)
+{
+	::SetDlgItemTextW(m_hWnd, id, str);
+}
+
+void TTCWnd::SetDlgItemTextA(int id, const char *str)
+{
+	::SetDlgItemTextA(m_hWnd, id, str);
+}
+
+void TTCWnd::SetDlgItemNum(int id, LONG Num)
+{
+	SetDlgNum(m_hWnd, id, Num);
+}
+
 // nCheck	BST_UNCHECKED / BST_CHECKED / BST_INDETERMINATE 
 void TTCWnd::SetCheck(int id, int nCheck)
 {
@@ -137,11 +172,16 @@
 	::ShowWindow(m_hWnd, nCmdShow);
 }
 
-void TTCWnd::SetWindowText(const TCHAR *str)
+void TTCWnd::SetWindowTextT(const TCHAR *str)
 {
 	::SetWindowText(m_hWnd, str);
 }
 
+void TTCWnd::SetWindowTextA(const char *str)
+{
+	::SetWindowTextA(m_hWnd, str);
+}
+
 LONG_PTR TTCWnd::SetWindowLongPtr(int nIndex, LONG_PTR dwNewLong)
 {
 	return ::SetWindowLongPtr(m_hWnd, nIndex, dwNewLong);
@@ -179,11 +219,16 @@
 	ModifyStyleCom(GWL_EXSTYLE, dwRemove, dwAdd, nFlags);
 }
 
-int TTCWnd::MessageBox(LPCTSTR lpText, LPCTSTR lpCaption, UINT uType)
+int TTCWnd::MessageBoxT(LPCTSTR lpText, LPCTSTR lpCaption, UINT uType)
 {
 	return ::MessageBox(m_hWnd, lpText, lpCaption, uType);
 }
 
+int TTCWnd::MessageBoxA(const char *lpText, const char *lpCaption, UINT uType)
+{
+	return ::MessageBoxA(m_hWnd, lpText, lpCaption, uType);
+}
+
 BOOL TTCWnd::GetWindowRect(RECT *R)
 {
 	return ::GetWindowRect(m_hWnd, R);
@@ -480,7 +525,7 @@
 		dlgproc = nullptr;
 	}
 	pseudoPtr = this;
-	HWND hWnd = ::CreateDialogIndirectParam(
+	HWND hWnd = ::CreateDialogIndirectParamW(
 		hInstance, lpTemplate, hParent,
 		dlgproc, (LPARAM)this);
 	pseudoPtr = nullptr;

Modified: branches/cmake/teraterm/common/tmfc.h
===================================================================
--- branches/cmake/teraterm/common/tmfc.h	2018-11-17 15:43:03 UTC (rev 7262)
+++ branches/cmake/teraterm/common/tmfc.h	2018-11-17 15:43:21 UTC (rev 7263)
@@ -47,12 +47,14 @@
 	BOOL EndPaint(LPPAINTSTRUCT lpPaint);
 	LRESULT SendMessage(UINT msg, WPARAM wp, LPARAM lp);
 	void ShowWindow(int nCmdShow);
-	void SetWindowText(const TCHAR *str);
+	void SetWindowTextT(const TCHAR *str);
+	void SetWindowTextA(const char *str);
 	LONG_PTR SetWindowLongPtr(int nIndex, LONG_PTR dwNewLong);
 	LONG_PTR GetWindowLongPtr(int nIndex);
 	void ModifyStyle(DWORD dwRemove, DWORD dwAdd, UINT nFlags = 0);
 	void ModifyStyleEx(DWORD dwRemove, DWORD dwAdd, UINT nFlags = 0);
-	int MessageBox(LPCTSTR lpText, LPCTSTR lpCaption, UINT uType);
+	int MessageBoxT(LPCTSTR lpText, LPCTSTR lpCaption, UINT uType);
+	int MessageBoxA(const char * lpText, const char *lpCaption, UINT uType);
 	virtual LRESULT DefWindowProc(UINT message, WPARAM wParam, LPARAM lParam);
 	BOOL GetWindowRect(RECT *R);
 	BOOL SetWindowPos(HWND hWndInsertAfter, int X, int Y, int cx, int cy, UINT uFlags);
@@ -61,9 +63,16 @@
 	BOOL EndDialog(int nResult);
 	// for controls
 	HWND GetDlgItem(int id);
-	LRESULT SendDlgItemMessage(int id, UINT msg, WPARAM wp, LPARAM lp);
-	void GetDlgItemText(int id, TCHAR *buf, size_t size);
-	void SetDlgItemText(int id, const TCHAR *str);
+	LRESULT SendDlgItemMessageT(int id, UINT msg, WPARAM wp, LPARAM lp);
+	LRESULT SendDlgItemMessageW(int id, UINT msg, WPARAM wp, LPARAM lp);
+	LRESULT SendDlgItemMessageA(int id, UINT msg, WPARAM wp, LPARAM lp);
+	void GetDlgItemTextT(int id, TCHAR *buf, size_t size);
+	void GetDlgItemTextW(int id, wchar_t *buf, size_t size);
+	void GetDlgItemTextA(int id, char *buf, size_t size);
+	void SetDlgItemTextT(int id, const TCHAR *str);
+	void SetDlgItemTextW(int id, const wchar_t *str);
+	void SetDlgItemTextA(int id, const char *str);
+	void SetDlgItemNum(int id, LONG Num);
 	void SetCheck(int id, int nCheck);
 	UINT GetCheck(int id);
 	void SetCurSel(int id, int no);

Modified: branches/cmake/teraterm/common/tmfc_frame.cpp
===================================================================
--- branches/cmake/teraterm/common/tmfc_frame.cpp	2018-11-17 15:43:03 UTC (rev 7262)
+++ branches/cmake/teraterm/common/tmfc_frame.cpp	2018-11-17 15:43:21 UTC (rev 7263)
@@ -63,7 +63,7 @@
 	DWORD dwExStyle)
 {
 	pseudoPtr = this;
-	HWND hWnd = ::CreateWindowExA(
+	HWND hWnd = ::CreateWindowEx(
 		0,
 		lpszClassName,
 		lpszWindowName,

Modified: branches/cmake/teraterm/common/ttlib.c
===================================================================
--- branches/cmake/teraterm/common/ttlib.c	2018-11-17 15:43:03 UTC (rev 7262)
+++ branches/cmake/teraterm/common/ttlib.c	2018-11-17 15:43:21 UTC (rev 7263)
@@ -213,7 +213,8 @@
 BOOL GetFileNamePos(PCHAR PathName, int *DirLen, int *FNPos)
 {
 	BYTE b;
-	LPTSTR Ptr, DirPtr, FNPtr, PtrOld;
+//	LPTSTR Ptr, DirPtr, FNPtr, PtrOld;
+	LPSTR Ptr, DirPtr, FNPtr, PtrOld;
 
 	*DirLen = 0;
 	*FNPos = 0;
@@ -225,7 +226,7 @@
 	else
 		Ptr = PathName;
 	if (Ptr[0]=='\\' || Ptr[0]=='/')
-		Ptr = CharNext(Ptr);
+		Ptr = CharNextA(Ptr);
 
 	DirPtr = Ptr;
 	FNPtr = Ptr;
@@ -232,7 +233,7 @@
 	while (Ptr[0]!=0) {
 		b = Ptr[0];
 		PtrOld = Ptr;
-		Ptr = CharNext(Ptr);
+		Ptr = CharNextA(Ptr);
 		switch (b) {
 			case ':':
 				return FALSE;
@@ -315,8 +316,8 @@
 // Append a slash to the end of a path name
 void AppendSlash(PCHAR Path, int destlen)
 {
-	if (strcmp(CharPrev((LPCTSTR)Path,
-	           (LPCTSTR)(&Path[strlen(Path)])),
+	if (strcmp(CharPrevA((LPCSTR)Path,
+	           (LPCSTR)(&Path[strlen(Path)])),
 	           "\\") != 0) {
 		strncat_s(Path,destlen,"\\",_TRUNCATE);
 	}
@@ -802,6 +803,46 @@
 	memcpy(Text, buf, size);
 }
 
+void RestoreNewLineW(wchar_t *Text)
+{
+	int i, j=0;
+	int size= wcslen(Text);
+	wchar_t *buf = (wchar_t *)_alloca((size+1) * sizeof(wchar_t));
+
+	memset(buf, 0, (size+1) * sizeof(wchar_t));
+	for (i=0; i<size; i++) {
+		if (Text[i] == L'\\' && i<size ) {
+			switch (Text[i+1]) {
+				case L'\\':
+					buf[j] = L'\\';
+					i++;
+					break;
+				case L'n':
+					buf[j] = L'\n';
+					i++;
+					break;
+				case L't':
+					buf[j] = L'\t';
+					i++;
+					break;
+				case L'0':
+					buf[j] = L'\0';
+					i++;
+					break;
+				default:
+					buf[j] = L'\\';
+			}
+			j++;
+		}
+		else {
+			buf[j] = Text[i];
+			j++;
+		}
+	}
+	/* use memcpy to copy with '\0' */
+	memcpy(Text, buf, size * sizeof(wchar_t));
+}
+
 BOOL GetNthString(PCHAR Source, int Nth, int Size, PCHAR Dest)
 {
 	int i, j, k;
@@ -859,7 +900,7 @@
 	char download[MAX_PATH];
 
 	memset(download, 0, sizeof(download));
-	if (hDll = LoadLibrary("shell32.dll")) {
+	if (hDll = LoadLibraryA("shell32.dll")) {
 		SHGETKNOWNFOLDERPATH pSHGetKnownFolderPath = (SHGETKNOWNFOLDERPATH)GetProcAddress(hDll, "SHGetKnownFolderPath");
 		if (pSHGetKnownFolderPath) {
 			PWSTR pBuffer = NULL;
@@ -871,7 +912,7 @@
 	if (strlen(download) == 0) {
 		LPITEMIDLIST pidl;
 		if (SHGetSpecialFolderLocation(NULL, CSIDL_PERSONAL, &pidl) == NOERROR) {
-			SHGetPathFromIDList(pidl, download);
+			SHGetPathFromIDListA(pidl, download);
 			CoTaskMemFree(pidl);
 		}
 	}
@@ -891,7 +932,7 @@
 	IMalloc *pmalloc;
 	SHGetMalloc(&pmalloc);
 	if (SHGetSpecialFolderLocation(NULL, CSIDL_PERSONAL, &pidl) == S_OK) {
-		SHGetPathFromIDList(pidl, MyDoc);
+		SHGetPathFromIDListA(pidl, MyDoc);
 		pmalloc->lpVtbl->Free(pmalloc, pidl);
 		pmalloc->lpVtbl->Release(pmalloc);
 	}
@@ -902,7 +943,7 @@
 	strncpy_s(MyDocSetupFName, sizeof(MyDocSetupFName), MyDoc, _TRUNCATE);
 	AppendSlash(MyDocSetupFName,sizeof(MyDocSetupFName));
 	strncat_s(MyDocSetupFName, sizeof(MyDocSetupFName), file, _TRUNCATE);
-	if (GetFileAttributes(MyDocSetupFName) != -1) {
+	if (GetFileAttributesA(MyDocSetupFName) != -1) {
 		strncpy_s(dest, destlen, MyDocSetupFName, _TRUNCATE);
 		return;
 	}
@@ -928,7 +969,7 @@
 	char CurDir[MAX_PATH];
 
 	/* Get home directory */
-	if (GetModuleFileName(NULL,Temp,sizeof(Temp)) == 0) {
+	if (GetModuleFileNameA(NULL,Temp,sizeof(Temp)) == 0) {
 		memset(buf, 0, buflen);
 		return;
 	}
@@ -938,13 +979,13 @@
 	GetDefaultSetupFName(HomeDir, SetupFName, sizeof(SetupFName));
 	
 	/* Get LanguageFile name */
-	GetPrivateProfileString("Tera Term", "UILanguageFile", "",
+	GetPrivateProfileStringA("Tera Term", "UILanguageFile", "",
 	                        Temp, sizeof(Temp), SetupFName);
 
-	GetCurrentDirectory(sizeof(CurDir), CurDir);
-	SetCurrentDirectory(HomeDir);
+	GetCurrentDirectoryA(sizeof(CurDir), CurDir);
+	SetCurrentDirectoryA(HomeDir);
 	_fullpath(buf, Temp, buflen);
-	SetCurrentDirectory(CurDir);
+	SetCurrentDirectoryA(CurDir);
 }
 
 // \x8Ew\x92肵\x82\xBD\x83G\x83\x93\x83g\x83\x8A\x82\xF0 teraterm.ini \x82\xA9\x82\xE7\x93ǂݎ\xE6\x82\xE9 (2009.3.23 yutaka)
@@ -955,7 +996,7 @@
 	char SetupFName[MAX_PATH];
 
 	/* Get home directory */
-	if (GetModuleFileName(NULL,Temp,sizeof(Temp)) == 0) {
+	if (GetModuleFileNameA(NULL,Temp,sizeof(Temp)) == 0) {
 		strncpy_s(buf, buflen, "off", _TRUNCATE);
 		return;
 	}
@@ -965,18 +1006,27 @@
 	GetDefaultSetupFName(HomeDir, SetupFName, sizeof(SetupFName));
 	
 	/* Get LanguageFile name */
-	GetPrivateProfileString("Tera Term", entry, "off",
+	GetPrivateProfileStringA("Tera Term", entry, "off",
 	                        Temp, sizeof(Temp), SetupFName);
 
 	strncpy_s(buf, buflen, Temp, _TRUNCATE);
 }
 
+void get_lang_msgT(const char *key, TCHAR *buf, int buf_len, const TCHAR *def, const char *iniFile)
+{
+#if defined(UNICODE)
+	GetI18nStrW("Tera Term", key, buf, buf_len, def, iniFile);
+#else	
+	GetI18nStr("Tera Term", key, buf, buf_len, def, iniFile);
+#endif
+}
+
 void get_lang_msg(const char *key, PCHAR buf, int buf_len, const char *def, const char *iniFile)
 {
 	GetI18nStr("Tera Term", key, buf, buf_len, def, iniFile);
 }
 
-int get_lang_font(PCHAR key, HWND dlg, PLOGFONT logfont, HFONT *font, const char *iniFile)
+int get_lang_font(PCHAR key, HWND dlg, PLOGFONTA logfont, HFONT *font, const char *iniFile)
 {
 	if (GetI18nLogfont("Tera Term", key, logfont,
 	                   GetDeviceCaps(GetDC(dlg),LOGPIXELSY),
@@ -984,7 +1034,7 @@
 		return FALSE;
 	}
 
-	if ((*font = CreateFontIndirect(logfont)) == NULL) {
+	if ((*font = CreateFontIndirectA(logfont)) == NULL) {
 		return FALSE;
 	}
 
@@ -1004,7 +1054,7 @@
 
 BOOL doSelectFolder(HWND hWnd, char *path, int pathlen, char *def, char *msg)
 {
-	BROWSEINFO      bi;
+	BROWSEINFOA     bi;
 	LPITEMIDLIST    pidlRoot;      // \x83u\x83\x89\x83E\x83Y\x82̃\x8B\x81[\x83gPIDL
 	LPITEMIDLIST    pidlBrowse;    // \x83\x86\x81[\x83U\x81[\x82\xAA\x91I\x91\xF0\x82\xB5\x82\xBDPIDL
 	char buf[MAX_PATH];
@@ -1029,10 +1079,10 @@
 	bi.lpfn = setDefaultFolder;
 	bi.lParam = (LPARAM)def;
 	// \x83t\x83H\x83\x8B\x83_\x91I\x91\xF0\x83_\x83C\x83A\x83\x8D\x83O\x82̕\\x8E\xA6 
-	pidlBrowse = SHBrowseForFolder(&bi);
+	pidlBrowse = SHBrowseForFolderA(&bi);
 	if (pidlBrowse != NULL) {  
 		// PIDL\x8C`\x8E\xAE\x82̖߂\xE8\x92l\x82̃t\x83@\x83C\x83\x8B\x83V\x83X\x83e\x83\x80\x82̃p\x83X\x82ɕϊ\xB7
-		if (SHGetPathFromIDList(pidlBrowse, buf)) {
+		if (SHGetPathFromIDListA(pidlBrowse, buf)) {
 			// \x8E擾\x90\xAC\x8C\xF7
 			strncpy_s(path, pathlen, buf, _TRUNCATE);
 			ret = TRUE;
@@ -1051,7 +1101,7 @@
 	va_list arg;
 	va_start(arg, fmt);
 	_vsnprintf(tmp, sizeof(tmp), fmt, arg);
-	OutputDebugString(tmp);
+	OutputDebugStringA(tmp);
 }
 
 #if (_MSC_VER < 1800)
@@ -1244,10 +1294,10 @@
 	static func pVerSetConditionMask = NULL;
 	char kernel32_dll[MAX_PATH];
 
-	GetSystemDirectory(kernel32_dll, sizeof(kernel32_dll));
+	GetSystemDirectoryA(kernel32_dll, sizeof(kernel32_dll));
 	strncat_s(kernel32_dll, sizeof(kernel32_dll), "\\kernel32.dll", _TRUNCATE);
 	if (hmodKernel32 == NULL) {
-		hmodKernel32 = LoadLibrary(kernel32_dll);
+		hmodKernel32 = LoadLibraryA(kernel32_dll);
 		if (hmodKernel32 != NULL) {
 			pVerSetConditionMask = (func)GetProcAddress(hmodKernel32, "VerSetConditionMask");
 		}
@@ -1384,7 +1434,7 @@
 {
 	HMODULE mod;
 
-	if (((mod = GetModuleHandle("user32.dll")) != NULL) &&
+	if (((mod = GetModuleHandleA("user32.dll")) != NULL) &&
 	    (GetProcAddress(mod, "MonitorFromPoint") != NULL)) {
 		return TRUE;
 	}
@@ -1398,7 +1448,7 @@
 {
 	HMODULE mod;
 
-	if (((mod = GetModuleHandle("iphlpapi.dll")) != NULL) &&
+	if (((mod = GetModuleHandleA("iphlpapi.dll")) != NULL) &&
 		(GetProcAddress(mod, "GetAdaptersAddresses") != NULL)) {
 		return TRUE;
 	}
@@ -1411,7 +1461,7 @@
 {
 	HMODULE mod;
 
-	if (((mod = GetModuleHandle("Dnsapi.dll")) != NULL) &&
+	if (((mod = GetModuleHandleA("Dnsapi.dll")) != NULL) &&
 		(GetProcAddress(mod, "DnsQuery") != NULL)) {
 		return TRUE;
 	}
@@ -1425,6 +1475,7 @@
 	return IsWindows2000OrLater() || IsWindowsMe();
 }
 
+// TODO check unicode
 int get_OPENFILENAME_SIZE()
 {
 	if (IsWindows2000OrLater()) {

Modified: branches/cmake/teraterm/common/ttlib.h
===================================================================
--- branches/cmake/teraterm/common/ttlib.h	2018-11-17 15:43:03 UTC (rev 7262)
+++ branches/cmake/teraterm/common/ttlib.h	2018-11-17 15:43:21 UTC (rev 7263)
@@ -74,6 +74,7 @@
 void ParseStrftimeFileName(PCHAR FName, int destlen);
 void ConvFName(PCHAR HomeDir, PCHAR Temp, int templen, PCHAR DefExt, PCHAR FName, int destlen);
 void RestoreNewLine(PCHAR Text);
+void RestoreNewLineW(wchar_t *Text);
 BOOL GetNthString(PCHAR Source, int Nth, int Size, PCHAR Dest);
 void GetNthNum(PCHAR Source, int Nth, int *Num);
 int GetNthNum2(PCHAR Source, int Nth, int defval);
@@ -83,7 +84,8 @@
 void GetUILanguageFile(char *buf, int buflen);
 void GetOnOffEntryInifile(char *entry, char *buf, int buflen);
 void get_lang_msg(const char *key, PCHAR buf, int buf_len, const char *def, const char *iniFile);
-int get_lang_font(PCHAR key, HWND dlg, PLOGFONT logfont, HFONT *font, const char *iniFile);
+void get_lang_msgT(const char *key, TCHAR *buf, int buf_len, const TCHAR *def, const char *iniFile);
+int get_lang_font(PCHAR key, HWND dlg, PLOGFONTA logfont, HFONT *font, const char *iniFile);
 DllExport BOOL doSelectFolder(HWND hWnd, char *path, int pathlen, char *def, char *msg);
 DllExport void OutputDebugPrintf(const char *fmt, ...);
 DllExport BOOL is_NT4();

Modified: branches/cmake/teraterm/teraterm/CMakeLists.txt
===================================================================
--- branches/cmake/teraterm/teraterm/CMakeLists.txt	2018-11-17 15:43:03 UTC (rev 7262)
+++ branches/cmake/teraterm/teraterm/CMakeLists.txt	2018-11-17 15:43:21 UTC (rev 7263)
@@ -10,6 +10,11 @@
   string(REPLACE "/MD" "/MT" CMAKE_CXX_FLAGS_RELEASE        ${CMAKE_CXX_FLAGS_RELEASE})
 endif ()
 
+option(USE_UNICODE_API "unicode" ON)
+
+if(USE_UNICODE_API)
+  add_definitions(-DUNICODE -D_UNICODE)
+endif()
 set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/")
 
 set(COMMON_SRC
@@ -32,6 +37,8 @@
   ../common/tmfc.cpp
   ../common/tmfc.h
   ../common/tmfc_frame.cpp
+  ../common/i18n.c
+  ../common/i18n.h
   )
 
 source_group(
@@ -40,6 +47,18 @@
   ${COMMON_SRC}
   )
 
+set(TTDLG_SRC
+  ../ttpdlg/dlg_res.h
+  ../ttpdlg/ttdlg.c
+  ../ttpdlg/ttpdlg.rc
+  )
+
+source_group(
+  "ttdlg"
+  FILES
+  ${TTDLG_SRC}
+  )
+
 set(SRC
   addsetting.cpp
   addsetting.h
@@ -107,10 +126,8 @@
   #
   ${CMAKE_CURRENT_BINARY_DIR}/svnversion.h
   #
-  ../ttpdlg/ttdlg.c
-  ../ttpdlg/ttpdlg.rc
-  #
   ${COMMON_SRC}
+  ${TTDLG_SRC}
   )
 
 include_directories(
@@ -124,6 +141,7 @@
   )
 
 link_directories(
+#  ${PROJECT_SOURCE_DIR}/libs/unicows_mingw/liblibunicows.a
   ${ONIGURUMA_LIBRARY_DIRS}
   ${SFMT_LIBRARY_DIRS}
   )

Modified: branches/cmake/teraterm/teraterm/addsetting.cpp
===================================================================
--- branches/cmake/teraterm/teraterm/addsetting.cpp	2018-11-17 15:43:03 UTC (rev 7262)
+++ branches/cmake/teraterm/teraterm/addsetting.cpp	2018-11-17 15:43:21 UTC (rev 7263)
@@ -35,6 +35,7 @@
 #include <windows.h>
 #include <commctrl.h>
 #include <time.h>
+#include <tchar.h>
 
 #include "addsetting.h"
 #include "teraterm.h"
@@ -45,6 +46,15 @@
 #include "dlglib.h"
 #include "compat_win.h"
 
+#undef GetDlgItemText
+#define GetDlgItemText GetDlgItemTextA
+#undef SetDlgItemText
+#define SetDlgItemText SetDlgItemTextA
+#undef MessageBox
+#define MessageBox MessageBoxA
+#undef SendDlgItemMessage
+#define SendDlgItemMessage SendDlgItemMessageA
+
 const mouse_cursor_t MouseCursor[] = {
 	{"ARROW", IDC_ARROW},
 	{"IBEAM", IDC_IBEAM},
@@ -54,26 +64,18 @@
 };
 #define MOUSE_CURSOR_MAX (sizeof(MouseCursor)/sizeof(MouseCursor[0]) - 1)
 
-static void SetupRGBbox(HWND hDlgWnd, int index)
+void CVisualPropPageDlg::SetupRGBbox(int index)
 {
-	HWND hWnd;
 	BYTE c;
-	char buf[10];
 
-	hWnd = GetDlgItem(hDlgWnd, IDC_COLOR_RED);
 	c = GetRValue(ts.ANSIColor[index]);
-	_snprintf_s(buf, sizeof(buf), _TRUNCATE, "%d", c);
-	SendMessage(hWnd, WM_SETTEXT , 0, (LPARAM)buf);
+	SetDlgItemNum(IDC_COLOR_RED, c);
 
-	hWnd = GetDlgItem(hDlgWnd, IDC_COLOR_GREEN);
 	c = GetGValue(ts.ANSIColor[index]);
-	_snprintf_s(buf, sizeof(buf), _TRUNCATE, "%d", c);
-	SendMessage(hWnd, WM_SETTEXT , 0, (LPARAM)buf);
+	SetDlgItemNum(IDC_COLOR_GREEN, c);
 
-	hWnd = GetDlgItem(hDlgWnd, IDC_COLOR_BLUE);
 	c = GetBValue(ts.ANSIColor[index]);
-	_snprintf_s(buf, sizeof(buf), _TRUNCATE, "%d", c);
-	SendMessage(hWnd, WM_SETTEXT , 0, (LPARAM)buf);
+	SetDlgItemNum(IDC_COLOR_BLUE, c);
 }
 
 // CGeneralPropPageDlg \x83_\x83C\x83A\x83\x8D\x83O
@@ -81,9 +83,10 @@
 CGeneralPropPageDlg::CGeneralPropPageDlg(HINSTANCE inst, TTCPropertySheet *sheet)
 	: TTCPropertyPage(inst, CGeneralPropPageDlg::IDD, sheet)
 {
-	get_lang_msg("DLG_TABSHEET_TITLE_GENERAL", ts.UIMsg, sizeof(ts.UIMsg),
-	             "General", ts.UILanguageFile);
-	m_psp.pszTitle = _tcsdup(ts.UIMsg);
+	TCHAR UIMsg[MAX_UIMSG];
+	get_lang_msgT("DLG_TABSHEET_TITLE_GENERAL", UIMsg, _countof(UIMsg),
+	             _T("General"), ts.UILanguageFile);
+	m_psp.pszTitle = _tcsdup(UIMsg);
 	m_psp.dwFlags |= PSP_USETITLE;
 }
 
@@ -127,9 +130,7 @@
 	SetCheck(IDC_ACCEPT_BROADCAST, ts.AcceptBroadcast);
 
 	// (4)IDC_MOUSEWHEEL_SCROLL_LINE
-	char buf[64];
-	_snprintf_s(buf, sizeof(buf), "%d", ts.MouseWheelScrollLine);
-	SetDlgItemText(IDC_SCROLL_LINE, buf);
+	SetDlgItemNum(IDC_SCROLL_LINE, ts.MouseWheelScrollLine);
 
 	// (5)IDC_AUTOSCROLL_ONLY_IN_BOTTOM_LINE
 	SetCheck(IDC_AUTOSCROLL_ONLY_IN_BOTTOM_LINE, ts.AutoScrollOnlyInBottomLine);
@@ -157,7 +158,7 @@
 
 void CGeneralPropPageDlg::OnOK()
 {
-	char buf[64];
+	TCHAR buf[64];
 	int val;
 
 	// (1)
@@ -170,8 +171,8 @@
 	ts.AcceptBroadcast = GetCheck(IDC_ACCEPT_BROADCAST);
 
 	// (4)IDC_MOUSEWHEEL_SCROLL_LINE
-	GetDlgItemText(IDC_SCROLL_LINE, buf, sizeof(buf));
-	val = atoi(buf);
+	GetDlgItemTextT(IDC_SCROLL_LINE, buf, _countof(buf));
+	val = _tstoi(buf);
 	if (val > 0)
 		ts.MouseWheelScrollLine = val;
 
@@ -205,9 +206,10 @@
 CSequencePropPageDlg::CSequencePropPageDlg(HINSTANCE inst, TTCPropertySheet *sheet)
 	: TTCPropertyPage(inst, CSequencePropPageDlg::IDD, sheet)
 {
-	get_lang_msg("DLG_TABSHEET_TITLE_SEQUENCE", ts.UIMsg, sizeof(ts.UIMsg),
-	             "Control Sequence", ts.UILanguageFile);
-	m_psp.pszTitle = _tcsdup(ts.UIMsg);
+	TCHAR UIMsg[MAX_UIMSG];
+	get_lang_msgT("DLG_TABSHEET_TITLE_SEQUENCE", UIMsg, _countof(UIMsg),
+	             _T("Control Sequence"), ts.UILanguageFile);
+	m_psp.pszTitle = _tcsdup(UIMsg);
 	m_psp.dwFlags |= PSP_USETITLE;
 }
 
@@ -389,9 +391,10 @@
 CCopypastePropPageDlg::CCopypastePropPageDlg(HINSTANCE inst, TTCPropertySheet *sheet)
 	: TTCPropertyPage(inst, CCopypastePropPageDlg::IDD, sheet)
 {
-	get_lang_msg("DLG_TABSHEET_TITLE_COPYPASTE", ts.UIMsg, sizeof(ts.UIMsg),
-	             "Copy and Paste", ts.UILanguageFile);
-	m_psp.pszTitle = _tcsdup(ts.UIMsg);
+	TCHAR UIMsg[MAX_UIMSG];
+	get_lang_msgT("DLG_TABSHEET_TITLE_COPYPASTE", UIMsg, _countof(UIMsg),
+				  _T("Copy and Paste"), ts.UILanguageFile);
+	m_psp.pszTitle = _tcsdup(UIMsg);
 	m_psp.dwFlags |= PSP_USETITLE;
 }
 
@@ -453,7 +456,7 @@
 	SetCheck(IDC_CONFIRM_CHANGE_PASTE, (ts.PasteFlag & CPF_CONFIRM_CHANGEPASTE)?BST_CHECKED:BST_UNCHECKED);
 
 	// \x83t\x83@\x83C\x83\x8B\x83p\x83X
-	SetDlgItemText(IDC_CONFIRM_STRING_FILE, ts.ConfirmChangePasteStringFile);
+	SetDlgItemTextA(IDC_CONFIRM_STRING_FILE, ts.ConfirmChangePasteStringFile);
 	if (ts.PasteFlag & CPF_CONFIRM_CHANGEPASTE) {
 		EnableDlgItem(IDC_CONFIRM_STRING_FILE, TRUE);
 		EnableDlgItem(IDC_CONFIRM_STRING_FILE_PATH, TRUE);
@@ -463,12 +466,12 @@
 	}
 
 	// (9)delimiter characters
-	SetDlgItemText(IDC_DELIM_LIST, ts.DelimList);
+	SetDlgItemTextA(IDC_DELIM_LIST, ts.DelimList);
 
 	// (10)PasteDelayPerLine
 	char buf[64];
 	_snprintf_s(buf, sizeof(buf), "%d", ts.PasteDelayPerLine);
-	SetDlgItemText(IDC_PASTEDELAY_EDIT, buf);
+	SetDlgItemNum(IDC_PASTEDELAY_EDIT, ts.PasteDelayPerLine);
 
 	// \x83_\x83C\x83A\x83\x8D\x83O\x82Ƀt\x83H\x81[\x83J\x83X\x82𓖂Ă\xE9
 	::SetFocus(::GetDlgItem(GetSafeHwnd(), IDC_LINECOPY));
@@ -496,7 +499,7 @@
 
 		case IDC_CONFIRM_STRING_FILE_PATH | (BN_CLICKED << 16):
 			{
-				OPENFILENAME ofn;
+				OPENFILENAMEA ofn;
 
 				memset(&ofn, 0, sizeof(ofn));
 				ofn.lStructSize = get_OPENFILENAME_SIZE();
@@ -510,8 +513,8 @@
 				             "Choose a file including strings for ConfirmChangePaste", ts.UILanguageFile);
 				ofn.lpstrTitle = uimsg;
 				ofn.Flags = OFN_FILEMUSTEXIST | OFN_PATHMUSTEXIST | OFN_FORCESHOWHIDDEN | OFN_HIDEREADONLY;
-				if (GetOpenFileName(&ofn) != 0) {
-					SetDlgItemText(IDC_CONFIRM_STRING_FILE, ts.ConfirmChangePasteStringFile);
+				if (GetOpenFileNameA(&ofn) != 0) {
+					SetDlgItemTextA(IDC_CONFIRM_STRING_FILE, ts.ConfirmChangePasteStringFile);
 				}
 			}
 			return TRUE;
@@ -578,13 +581,13 @@
 	else {
 		ts.PasteFlag &= ~CPF_CONFIRM_CHANGEPASTE;
 	}
-	GetDlgItemText(IDC_CONFIRM_STRING_FILE, ts.ConfirmChangePasteStringFile, sizeof(ts.ConfirmChangePasteStringFile));
+	GetDlgItemTextA(IDC_CONFIRM_STRING_FILE, ts.ConfirmChangePasteStringFile, sizeof(ts.ConfirmChangePasteStringFile));
 
 	// (9)
-	GetDlgItemText(IDC_DELIM_LIST, ts.DelimList, sizeof(ts.DelimList));
+	GetDlgItemTextA(IDC_DELIM_LIST, ts.DelimList, sizeof(ts.DelimList));
 
 	// (10)
-	GetDlgItemText(IDC_PASTEDELAY_EDIT, buf, sizeof(buf));
+	GetDlgItemTextA(IDC_PASTEDELAY_EDIT, buf, sizeof(buf));
 	val = atoi(buf);
 	ts.PasteDelayPerLine =
 		(val < 0) ? 0 :
@@ -597,9 +600,10 @@
 CVisualPropPageDlg::CVisualPropPageDlg(HINSTANCE inst, TTCPropertySheet *sheet)
 	: TTCPropertyPage(inst, CVisualPropPageDlg::IDD, sheet)
 {
-	get_lang_msg("DLG_TABSHEET_TITLE_VISUAL", ts.UIMsg, sizeof(ts.UIMsg),
-	             "Visual", ts.UILanguageFile);
-	m_psp.pszTitle = _tcsdup(ts.UIMsg);
+	TCHAR UIMsg[MAX_UIMSG];
+	get_lang_msgT("DLG_TABSHEET_TITLE_VISUAL", UIMsg, _countof(UIMsg),
+	             _T("Visual"), ts.UILanguageFile);
+	m_psp.pszTitle = _tcsdup(UIMsg);
 	m_psp.dwFlags |= PSP_USETITLE;
 }
 
@@ -650,18 +654,18 @@
 
 	// (1)AlphaBlend
 	_snprintf_s(buf, sizeof(buf), _TRUNCATE, "%d", ts.AlphaBlendActive);
-	SetDlgItemText(IDC_ALPHA_BLEND_ACTIVE, buf);
+	SetDlgItemNum(IDC_ALPHA_BLEND_ACTIVE, ts.AlphaBlendActive);
 	_snprintf_s(buf, sizeof(buf), _TRUNCATE, "%d", ts.AlphaBlendInactive);
-	SetDlgItemText(IDC_ALPHA_BLEND_INACTIVE, buf);
+	SetDlgItemNum(IDC_ALPHA_BLEND_INACTIVE, ts.AlphaBlendInactive);
 
 	// (2)[BG] BGEnable
 	SetCheck(IDC_ETERM_LOOKFEEL, ts.EtermLookfeel.BGEnable);
 
 	// Eterm look-feel\x82̔w\x8Ci\x89摜\x8Ew\x92\xE8\x81B
-	SetDlgItemText(IDC_BGIMG_EDIT, ts.BGImageFilePath);
+	SetDlgItemTextA(IDC_BGIMG_EDIT, ts.BGImageFilePath);
 
 	_snprintf_s(buf, sizeof(buf), _TRUNCATE, "%d", ts.BGImgBrightness);
-	SetDlgItemText(IDC_EDIT_BGIMG_BRIGHTNESS, buf);
+	SetDlgItemNum(IDC_EDIT_BGIMG_BRIGHTNESS, ts.BGImgBrightness);
 
 	if (ts.EtermLookfeel.BGEnable) {
 		EnableDlgItem(IDC_BGIMG_CHECK, TRUE);
@@ -693,9 +697,9 @@
 	// (3)Mouse cursor type
 	int sel = 0;
 	for (int i = 0 ; MouseCursor[i].name ; i++) {
-		const TCHAR *name = MouseCursor[i].name;
-		SendDlgItemMessage(IDC_MOUSE_CURSOR, CB_ADDSTRING, i, (LPARAM)name);
-		if (_tcscmp(name, ts.MouseCursorName) == 0) {
+		const char *name = MouseCursor[i].name;
+		SendDlgItemMessageA(IDC_MOUSE_CURSOR, CB_ADDSTRING, i, (LPARAM)name);
+		if (strcmp(name, ts.MouseCursorName) == 0) {
 			sel = i;
 		}
 	}
@@ -720,9 +724,9 @@
 	// (5)ANSI color
 	for (int i = 0 ; i < 16 ; i++) {
 		_snprintf_s(buf, sizeof(buf), _TRUNCATE, "%d", i);
-		SendDlgItemMessage(IDC_ANSI_COLOR, LB_INSERTSTRING, i, (LPARAM)buf);
+		SendDlgItemMessageA(IDC_ANSI_COLOR, LB_INSERTSTRING, i, (LPARAM)buf);
 	}
-	SetupRGBbox(GetSafeHwnd(), 0);
+	SetupRGBbox(0);
 	SendDlgItemMessage(IDC_ANSI_COLOR, LB_SETCURSEL, 0, 0);
 	::InvalidateRect(GetDlgItem(IDC_SAMPLE_COLOR), NULL, TRUE);
 
@@ -781,7 +785,7 @@
 				// \x96\xB3\x8C\x{27B0B3}\x82ꂽ\x82\xE7\x81ABGThemeFile \x82\xF0\x8C\xB3\x82ɖ߂\xB7\x81B
 				strncpy_s(ts.EtermLookfeel.BGThemeFile, BG_THEME_IMAGEFILE_DEFAULT, sizeof(ts.EtermLookfeel.BGThemeFile));
 				// \x94w\x8Ci\x89摜\x82\xE0\x96\xB3\x8C\x{27B0B7}\x82\xE9\x81B
-				SetDlgItemText(IDC_BGIMG_EDIT, "");
+				SetDlgItemTextT(IDC_BGIMG_EDIT, _T(""));
 				SetDlgItemInt(IDC_EDIT_BGIMG_BRIGHTNESS, BG_THEME_IMAGE_BRIGHTNESS_DEFAULT);
 			}
 			return TRUE;
@@ -805,7 +809,7 @@
 				// \x96\xB3\x8C\x{27B0B3}\x82ꂽ\x82\xE7\x81ABGThemeFile \x82\xF0\x8C\xB3\x82ɖ߂\xB7\x81B
 				strncpy_s(ts.EtermLookfeel.BGThemeFile, BG_THEME_IMAGEFILE_DEFAULT, sizeof(ts.EtermLookfeel.BGThemeFile));
 				// \x94w\x8Ci\x89摜\x82\xE0\x96\xB3\x8C\x{27B0B7}\x82\xE9\x81B
-				SetDlgItemText(IDC_BGIMG_EDIT, "");
+				SetDlgItemTextT(IDC_BGIMG_EDIT, _T(""));
 				SetDlgItemInt(IDC_EDIT_BGIMG_BRIGHTNESS, BG_THEME_IMAGE_BRIGHTNESS_DEFAULT);
 			}
 			return TRUE;
@@ -813,7 +817,7 @@
 		case IDC_BGIMG_BUTTON | (BN_CLICKED << 16):
 			// \x94w\x8Ci\x89摜\x82\xF0\x83_\x83C\x83A\x83\x8D\x83O\x82Ŏw\x92肷\x82\xE9\x81B
 			{
-				OPENFILENAME ofn;
+				OPENFILENAMEA ofn;
 				char szFile[MAX_PATH];
 
 				memset(&ofn, 0, sizeof(ofn));
@@ -825,8 +829,8 @@
 				ofn.nMaxFile = _countof(szFile);
 				ofn.lpstrTitle = "select image file";
 				ofn.Flags = OFN_FILEMUSTEXIST | OFN_HIDEREADONLY;
-				if (GetOpenFileName(&ofn) != 0) {
-					SetDlgItemText(IDC_BGIMG_EDIT, szFile);
+				if (GetOpenFileNameA(&ofn) != 0) {
+					SetDlgItemTextA(IDC_BGIMG_EDIT, szFile);
 				}
 			}
 			return TRUE;
@@ -834,7 +838,7 @@
 		case IDC_ANSI_COLOR | (LBN_SELCHANGE << 16):
 			sel = SendDlgItemMessage(IDC_ANSI_COLOR, LB_GETCURSEL, 0, 0);
 			if (sel != -1) {
-				SetupRGBbox(GetSafeHwnd(), sel);
+				SetupRGBbox(sel);
 				::InvalidateRect(GetDlgItem(IDC_SAMPLE_COLOR), NULL, TRUE);
 			}
 			return TRUE;
@@ -851,19 +855,19 @@
 					return TRUE;
 				}
 
-				GetDlgItemText(IDC_COLOR_RED, buf, sizeof(buf));
+				GetDlgItemTextA(IDC_COLOR_RED, buf, sizeof(buf));
 				r = atoi(buf);
 
-				GetDlgItemText(IDC_COLOR_GREEN, buf, sizeof(buf));
+				GetDlgItemTextA(IDC_COLOR_GREEN, buf, sizeof(buf));
 				g = atoi(buf);
 
-				GetDlgItemText(IDC_COLOR_BLUE, buf, sizeof(buf));
+				GetDlgItemTextA(IDC_COLOR_BLUE, buf, sizeof(buf));
 				b = atoi(buf);
 
 				ts.ANSIColor[sel] = RGB(r, g, b);
 
 				// 255\x82𒴂\xA6\x82\xBDRGB\x92l\x82͕␳\x82\xB3\x82\xEA\x82\xE9\x82̂ŁA\x82\xBB\x82\xEA\x82\xF0Edit\x82ɕ\\x8E\xA6\x82\xB7\x82\xE9 (2007.2.18 maya)
-				SetupRGBbox(GetSafeHwnd(), sel);
+				SetupRGBbox(sel);
 
 				::InvalidateRect(GetDlgItem(IDC_SAMPLE_COLOR), NULL, TRUE);
 			}
@@ -880,13 +884,13 @@
 		BYTE r, g, b;
 		char buf[8];
 
-		GetDlgItemText(IDC_COLOR_RED, buf, sizeof(buf));
+		GetDlgItemTextA(IDC_COLOR_RED, buf, sizeof(buf));
 		r = atoi(buf);
 
-		GetDlgItemText(IDC_COLOR_GREEN, buf, sizeof(buf));
+		GetDlgItemTextA(IDC_COLOR_GREEN, buf, sizeof(buf));
 		g = atoi(buf);
 
-		GetDlgItemText(IDC_COLOR_BLUE, buf, sizeof(buf));
+		GetDlgItemTextA(IDC_COLOR_BLUE, buf, sizeof(buf));
 		b = atoi(buf);
 
 		SetBkMode(hDC, TRANSPARENT);
@@ -905,7 +909,7 @@
 	int flag_changed = 0;
 
 	// (1)
-	GetDlgItemText(IDC_ALPHA_BLEND_ACTIVE, buf, sizeof(buf));
+	GetDlgItemTextA(IDC_ALPHA_BLEND_ACTIVE, buf, sizeof(buf));
 	if (isdigit(buf[0])) {
 		int i = atoi(buf);
 		ts.AlphaBlendActive =
@@ -912,7 +916,7 @@
 			(i < 0) ? 0 :
 			(i > 255) ? 255 : i;
 	}
-	GetDlgItemText(IDC_ALPHA_BLEND_INACTIVE, buf, sizeof(buf));
+	GetDlgItemTextA(IDC_ALPHA_BLEND_INACTIVE, buf, sizeof(buf));
 	if (isdigit(buf[0])) {
 		int i = atoi(buf);
 		ts.AlphaBlendInactive = 
@@ -928,12 +932,12 @@
 		ts.EtermLookfeel.BGEnable = GetCheck(IDC_ETERM_LOOKFEEL);
 	}
 	if (ts.EtermLookfeel.BGEnable) {
-		GetDlgItemText(IDC_BGIMG_EDIT, ts.BGImageFilePath, sizeof(ts.BGImageFilePath));
+		GetDlgItemTextA(IDC_BGIMG_EDIT, ts.BGImageFilePath, sizeof(ts.BGImageFilePath));
 	} else {
 		strncpy_s(ts.BGImageFilePath, sizeof(ts.BGImageFilePath), "%SystemRoot%\\Web\\Wallpaper\\*.bmp", _TRUNCATE);
 	}
 
-	GetDlgItemText(IDC_EDIT_BGIMG_BRIGHTNESS, buf, sizeof(buf));
+	GetDlgItemTextA(IDC_EDIT_BGIMG_BRIGHTNESS, buf, sizeof(buf));
 	if (isdigit(buf[0])) {
 		int i = atoi(buf);
 		ts.BGImgBrightness = 
@@ -1028,9 +1032,10 @@
 CLogPropPageDlg::CLogPropPageDlg(HINSTANCE inst, TTCPropertySheet *sheet)
 	: TTCPropertyPage(inst, CLogPropPageDlg::IDD, sheet)
 {
-	get_lang_msg("DLG_TABSHEET_TITLE_Log", ts.UIMsg, sizeof(ts.UIMsg),
-	             "Log", ts.UILanguageFile);
-	m_psp.pszTitle = _tcsdup(ts.UIMsg);
+	TCHAR UIMsg[MAX_UIMSG];
+	get_lang_msgT("DLG_TABSHEET_TITLE_Log", UIMsg, _countof(UIMsg),
+	             _T("Log"), ts.UILanguageFile);
+	m_psp.pszTitle = _tcsdup(UIMsg);
 	m_psp.dwFlags |= PSP_USETITLE;
 }
 
@@ -1090,13 +1095,13 @@
 
 
 	// Viewlog Editor path (2005.1.29 yutaka)
-	SetDlgItemText(IDC_VIEWLOG_EDITOR, ts.ViewlogEditor);
+	SetDlgItemTextA(IDC_VIEWLOG_EDITOR, ts.ViewlogEditor);
 
 	// Log Default File Name (2006.8.28 maya)
-	SetDlgItemText(IDC_DEFAULTNAME_EDITOR, ts.LogDefaultName);
+	SetDlgItemTextA(IDC_DEFAULTNAME_EDITOR, ts.LogDefaultName);
 
 	// Log Default File Path (2007.5.30 maya)
-	SetDlgItemText(IDC_DEFAULTPATH_EDITOR, ts.LogDefaultPath);
+	SetDlgItemTextA(IDC_DEFAULTPATH_EDITOR, ts.LogDefaultPath);
 
 	/* Auto start logging (2007.5.31 maya) */
 	SetCheck(IDC_AUTOSTART, ts.LogAutoStart);
@@ -1173,12 +1178,13 @@
 BOOL CLogPropPageDlg::OnCommand(WPARAM wParam, LPARAM lParam)
 {
 	char uimsg[MAX_UIMSG];
-	char buf[MAX_PATH], buf2[MAX_PATH];
+	char buf[MAX_PATH];
+	char buf2[MAX_PATH];
 
 	switch (wParam) {
 		case IDC_VIEWLOG_PATH | (BN_CLICKED << 16):
 			{
-				OPENFILENAME ofn;
+				OPENFILENAMEA ofn;
 
 				ZeroMemory(&ofn, sizeof(ofn));
 				ofn.lStructSize = get_OPENFILENAME_SIZE();
@@ -1192,8 +1198,8 @@
 				             "Choose a executing file with launching logging file", ts.UILanguageFile);
 				ofn.lpstrTitle = uimsg;
 				ofn.Flags = OFN_FILEMUSTEXIST | OFN_PATHMUSTEXIST | OFN_FORCESHOWHIDDEN | OFN_HIDEREADONLY;
-				if (GetOpenFileName(&ofn) != 0) {
-					SetDlgItemText(IDC_VIEWLOG_EDITOR, ts.ViewlogEditor);
+				if (GetOpenFileNameA(&ofn) != 0) {
+					SetDlgItemTextA(IDC_VIEWLOG_EDITOR, ts.ViewlogEditor);
 				}
 			}
 			return TRUE;
@@ -1267,15 +1273,15 @@
 	char uimsg[MAX_UIMSG];
 
 	// Viewlog Editor path (2005.1.29 yutaka)
-	GetDlgItemText(IDC_VIEWLOG_EDITOR, ts.ViewlogEditor, sizeof(ts.ViewlogEditor));
+	GetDlgItemText(IDC_VIEWLOG_EDITOR, ts.ViewlogEditor, _countof(ts.ViewlogEditor));
 
 	// Log Default File Name (2006.8.28 maya)
-	GetDlgItemText(IDC_DEFAULTNAME_EDITOR, buf, sizeof(buf));
+	GetDlgItemTextA(IDC_DEFAULTNAME_EDITOR, buf, sizeof(buf));
 	if (isInvalidStrftimeChar(buf)) {
 		get_lang_msg("MSG_ERROR", uimsg, sizeof(uimsg), "ERROR", ts.UILanguageFile);
 		get_lang_msg("MSG_LOGFILE_INVALID_CHAR_ERROR", ts.UIMsg, sizeof(ts.UIMsg),
 		             "Invalid character is included in log file name.", ts.UILanguageFile);
-		MessageBox(ts.UIMsg, uimsg, MB_ICONEXCLAMATION);
+		MessageBoxA(ts.UIMsg, uimsg, MB_ICONEXCLAMATION);
 		return;
 	}
 
@@ -1300,7 +1306,7 @@
 	strncpy_s(ts.LogDefaultName, sizeof(ts.LogDefaultName), buf, _TRUNCATE);
 
 	// Log Default File Path (2007.5.30 maya)
-	GetDlgItemText(IDC_DEFAULTPATH_EDITOR, ts.LogDefaultPath, sizeof(ts.LogDefaultPath));
+	GetDlgItemText(IDC_DEFAULTPATH_EDITOR, ts.LogDefaultPath, _countof(ts.LogDefaultPath));
 
 	/* Auto start logging (2007.5.31 maya) */
 	ts.LogAutoStart = GetCheck(IDC_AUTOSTART);
@@ -1380,9 +1386,10 @@
 CCygwinPropPageDlg::CCygwinPropPageDlg(HINSTANCE inst, TTCPropertySheet *sheet)
 	: TTCPropertyPage(inst, CCygwinPropPageDlg::IDD, sheet)
 {
-	get_lang_msg("DLG_TABSHEET_TITLE_CYGWIN", ts.UIMsg, sizeof(ts.UIMsg),
-	             "Cygwin", ts.UILanguageFile);
-	m_psp.pszTitle = _tcsdup(ts.UIMsg);
+	TCHAR UIMsg[MAX_UIMSG];
+	get_lang_msgT("DLG_TABSHEET_TITLE_CYGWIN", UIMsg, _countof(UIMsg),
+	             _T("Cygwin"), ts.UILanguageFile);
+	m_psp.pszTitle = _tcsdup(UIMsg);
 	m_psp.dwFlags |= PSP_USETITLE;
 }
 
@@ -1404,13 +1411,13 @@
 
 	memcpy(&settings, &ts.CygtermSettings, sizeof(cygterm_t));
 
-	SetDlgItemText(IDC_TERM_EDIT, settings.term);
-	SetDlgItemText(IDC_TERM_TYPE, settings.term_type);
-	SetDlgItemText(IDC_PORT_START, settings.port_start);
-	SetDlgItemText(IDC_PORT_RANGE, settings.port_range);
-	SetDlgItemText(IDC_SHELL, settings.shell);
-	SetDlgItemText(IDC_ENV1, settings.env1);
-	SetDlgItemText(IDC_ENV2, settings.env2);
+	SetDlgItemTextA(IDC_TERM_EDIT, settings.term);
+	SetDlgItemTextA(IDC_TERM_TYPE, settings.term_type);
+	SetDlgItemTextA(IDC_PORT_START, settings.port_start);
+	SetDlgItemTextA(IDC_PORT_RANGE, settings.port_range);
+	SetDlgItemTextA(IDC_SHELL, settings.shell);
+	SetDlgItemTextA(IDC_ENV1, settings.env1);
+	SetDlgItemTextA(IDC_ENV2, settings.env2);
 
 	SetCheck(IDC_LOGIN_SHELL, settings.login_shell);
 	SetCheck(IDC_HOME_CHDIR, settings.home_chdir);
@@ -1417,7 +1424,7 @@
 	SetCheck(IDC_AGENT_PROXY, settings.agent_proxy);
 
 	// Cygwin install path
-	SetDlgItemText(IDC_CYGWIN_PATH, ts.CygwinDirectory);
+	SetDlgItemTextA(IDC_CYGWIN_PATH, ts.CygwinDirectory);
 
 	// \x83_\x83C\x83A\x83\x8D\x83O\x82Ƀt\x83H\x81[\x83J\x83X\x82𓖂Ă\xE9
 	::SetFocus(::GetDlgItem(GetSafeHwnd(), IDC_CYGWIN_PATH));
@@ -1432,9 +1439,9 @@
 			// Cygwin install \x83f\x83B\x83\x8C\x83N\x83g\x83\x8A\x82̑I\x91\xF0\x83_\x83C\x83A\x83\x8D\x83O
 			get_lang_msg("DIRDLG_CYGTERM_DIR_TITLE", ts.UIMsg, sizeof(ts.UIMsg),
 			             "Select Cygwin directory", ts.UILanguageFile);
-			GetDlgItemText(IDC_CYGWIN_PATH, buf, sizeof(buf));
+			GetDlgItemTextA(IDC_CYGWIN_PATH, buf, sizeof(buf));
 			if (doSelectFolder(GetSafeHwnd(), buf2, sizeof(buf2), buf, ts.UIMsg)) {
-				SetDlgItemText(IDC_CYGWIN_PATH, buf2);
+				SetDlgItemTextA(IDC_CYGWIN_PATH, buf2);
 			}
 			return TRUE;
 	}
@@ -1445,13 +1452,13 @@
 void CCygwinPropPageDlg::OnOK()
 {
 	// writing to CygTerm config file
-	GetDlgItemText(IDC_TERM_EDIT, settings.term, sizeof(settings.term));
-	GetDlgItemText(IDC_TERM_TYPE, settings.term_type, sizeof(settings.term_type));
-	GetDlgItemText(IDC_PORT_START, settings.port_start, sizeof(settings.port_start));
-	GetDlgItemText(IDC_PORT_RANGE, settings.port_range, sizeof(settings.port_range));
-	GetDlgItemText(IDC_SHELL, settings.shell, sizeof(settings.shell));
-	GetDlgItemText(IDC_ENV1, settings.env1, sizeof(settings.env1));
-	GetDlgItemText(IDC_ENV2, settings.env2, sizeof(settings.env2));
+	GetDlgItemTextA(IDC_TERM_EDIT, settings.term, sizeof(settings.term));
+	GetDlgItemTextA(IDC_TERM_TYPE, settings.term_type, sizeof(settings.term_type));
+	GetDlgItemTextA(IDC_PORT_START, settings.port_start, sizeof(settings.port_start));
+	GetDlgItemTextA(IDC_PORT_RANGE, settings.port_range, sizeof(settings.port_range));
+	GetDlgItemTextA(IDC_SHELL, settings.shell, sizeof(settings.shell));
+	GetDlgItemTextA(IDC_ENV1, settings.env1, sizeof(settings.env1));
+	GetDlgItemTextA(IDC_ENV2, settings.env2, sizeof(settings.env2));
 
 	settings.login_shell = GetCheck(IDC_LOGIN_SHELL);
 	settings.home_chdir = GetCheck(IDC_HOME_CHDIR);
@@ -1463,7 +1470,7 @@
 	ts.CygtermSettings.update_flag = TRUE;
 
 	// Cygwin install path
-	GetDlgItemText(IDC_CYGWIN_PATH, ts.CygwinDirectory, sizeof(ts.CygwinDirectory));
+	GetDlgItemTextA(IDC_CYGWIN_PATH, ts.CygwinDirectory, sizeof(ts.CygwinDirectory));
 }
 
 // CAddSettingPropSheetDlg
@@ -1487,9 +1494,10 @@
 	m_psh.nPages = 6;
 	m_psh.phpage = hPsp;
 
-	get_lang_msg("DLG_TABSHEET_TITLE", ts.UIMsg, sizeof(ts.UIMsg),
+	TCHAR UIMsg[MAX_UIMSG];
+	get_lang_msgT("DLG_TABSHEET_TITLE", UIMsg, _countof(UIMsg),
 				 pszCaption, ts.UILanguageFile);
-	m_psh.pszCaption = _tcsdup(ts.UIMsg);
+	m_psh.pszCaption = _tcsdup(UIMsg);
 }
 
 CAddSettingPropSheetDlg::~CAddSettingPropSheetDlg()

Modified: branches/cmake/teraterm/teraterm/addsetting.h
===================================================================
--- branches/cmake/teraterm/teraterm/addsetting.h	2018-11-17 15:43:03 UTC (rev 7262)
+++ branches/cmake/teraterm/teraterm/addsetting.h	2018-11-17 15:43:21 UTC (rev 7263)
@@ -89,6 +89,7 @@
 	HBRUSH OnCtlColor(HDC hDC, HWND hWnd);
 	enum { IDD = IDD_TABSHEET_VISUAL };
 	BOOL OnCommand(WPARAM wParam, LPARAM lParam);
+	void SetupRGBbox(int index);
 };
 
 // Log Page

Modified: branches/cmake/teraterm/teraterm/buffer.c
===================================================================
--- branches/cmake/teraterm/teraterm/buffer.c	2018-11-17 15:43:03 UTC (rev 7262)
+++ branches/cmake/teraterm/teraterm/buffer.c	2018-11-17 15:43:21 UTC (rev 7263)
@@ -28,6 +28,8 @@
  */
 
 /* TERATERM.EXE, scroll buffer routines */
+#undef UNICODE
+#undef _UNICODE
 
 #include "teraterm.h"
 #include "tttypes.h"

Modified: branches/cmake/teraterm/teraterm/commlib.c
===================================================================
--- branches/cmake/teraterm/teraterm/commlib.c	2018-11-17 15:43:03 UTC (rev 7262)
+++ branches/cmake/teraterm/teraterm/commlib.c	2018-11-17 15:43:21 UTC (rev 7263)
@@ -29,6 +29,10 @@
 /* IPv6 modification is Copyright (C) 2000, 2001 Jun-ya KATO <kato****@win6*****> */
 
 /* TERATERM.EXE, Communication routines */
+
+#undef UNICODE
+#undef _UNICODE
+
 #include "teraterm.h"
 #include "tttypes.h"
 #include "tt_res.h"

Modified: branches/cmake/teraterm/teraterm/dnddlg.cpp
===================================================================
--- branches/cmake/teraterm/teraterm/dnddlg.cpp	2018-11-17 15:43:03 UTC (rev 7262)
+++ branches/cmake/teraterm/teraterm/dnddlg.cpp	2018-11-17 15:43:21 UTC (rev 7263)
@@ -39,7 +39,7 @@
 #include "dlglib.h"
 
 struct DrapDropDlgParam {
-	const char *TargetFilename;
+	const TCHAR *TargetFilename;
 	enum drop_type DropType;
 	unsigned char DropTypePaste;
 	bool ScpEnable;
@@ -136,10 +136,10 @@
 
 		// Do this for the next %d files
 		char orgmsg[MAX_UIMSG];
-		GetDlgItemText(hDlgWnd, IDC_SAME_PROCESS_CHECK, orgmsg, sizeof(orgmsg));
+		GetDlgItemTextA(hDlgWnd, IDC_SAME_PROCESS_CHECK, orgmsg, sizeof(orgmsg));
 		char uimsg[MAX_UIMSG];
 		_snprintf_s(uimsg, sizeof(uimsg), _TRUNCATE, orgmsg, Param->RemaingFileCount - 1);
-		SetDlgItemText(hDlgWnd, IDC_SAME_PROCESS_CHECK, uimsg);
+		SetDlgItemTextA(hDlgWnd, IDC_SAME_PROCESS_CHECK, uimsg);
 		if (Param->RemaingFileCount < 2) {
 			EnableWindow(GetDlgItem(hDlgWnd, IDC_SAME_PROCESS_CHECK), FALSE);
 		}
@@ -250,7 +250,7 @@
 
 enum drop_type ShowDropDialogBox(
 	HINSTANCE hInstance, HWND hWndParent,
-	const char *TargetFilename,
+	const TCHAR *TargetFilename,
 	enum drop_type DefaultDropType,
 	int RemaingFileCount,
 	bool EnableSCP,

Modified: branches/cmake/teraterm/teraterm/dnddlg.h
===================================================================
--- branches/cmake/teraterm/teraterm/dnddlg.h	2018-11-17 15:43:03 UTC (rev 7262)
+++ branches/cmake/teraterm/teraterm/dnddlg.h	2018-11-17 15:43:21 UTC (rev 7263)
@@ -1,54 +1,54 @@
-/*
- * (C) 2005-2018 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 <windows.h>
-#include "tttypes.h"	// for TTTSet
-
-enum drop_type {
-	DROP_TYPE_CANCEL,
-	DROP_TYPE_SCP,
-	DROP_TYPE_SEND_FILE,		// past contents of file
-	DROP_TYPE_SEND_FILE_BINARY,
-	DROP_TYPE_PASTE_FILENAME,
-};
-
-#define DROP_TYPE_PASTE_ESCAPE	0x01
-#define	DROP_TYPE_PASTE_NEWLINE	0x02
-
-enum drop_type ShowDropDialogBox(
-	HINSTANCE hInstance, HWND hWndParent,
-	const char *TargetFilename,
-	enum drop_type DefaultDropType,
-	int RemaingFileCount,
-	bool EnableSCP,
-	bool EnableSendFile,
-	TTTSet *pts,
-	unsigned char *DropTypePaste,
-	bool *DoSameProcess,
-	bool *DoSameProcessNextDrop,
-	bool *DoNotShowDialog);
+/*
+ * (C) 2005-2018 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 <windows.h>
+#include "tttypes.h"	// for TTTSet
+
+enum drop_type {
+	DROP_TYPE_CANCEL,
+	DROP_TYPE_SCP,
+	DROP_TYPE_SEND_FILE,		// past contents of file
+	DROP_TYPE_SEND_FILE_BINARY,
+	DROP_TYPE_PASTE_FILENAME,
+};
+
+#define DROP_TYPE_PASTE_ESCAPE	0x01
+#define	DROP_TYPE_PASTE_NEWLINE	0x02
+
+enum drop_type ShowDropDialogBox(
+	HINSTANCE hInstance, HWND hWndParent,
+	const TCHAR *TargetFilename,
+	enum drop_type DefaultDropType,
+	int RemaingFileCount,
+	bool EnableSCP,
+	bool EnableSendFile,
+	TTTSet *pts,
+	unsigned char *DropTypePaste,
+	bool *DoSameProcess,
+	bool *DoSameProcessNextDrop,
+	bool *DoNotShowDialog);

Modified: branches/cmake/teraterm/teraterm/filesys.cpp
===================================================================
--- branches/cmake/teraterm/teraterm/filesys.cpp	2018-11-17 15:43:03 UTC (rev 7262)
+++ branches/cmake/teraterm/teraterm/filesys.cpp	2018-11-17 15:43:21 UTC (rev 7263)
@@ -28,6 +28,8 @@
  */
 
 /* TERATERM.EXE, file transfer routines */
+//#undef UNICODE
+//#undef _UNICODE
 #include <stdio.h>
 #include <io.h>
 #include <process.h>
@@ -53,6 +55,13 @@
 
 #include "buffer.h"
 
+#undef GetUserName
+#define GetUserName GetUserNameA
+#undef CreateFile
+#define CreateFile CreateFileA
+#undef MessageBox
+#define MessageBox MessageBoxA
+
 #define FS_BRACKET_NONE  0
 #define FS_BRACKET_START 1
 #define FS_BRACKET_END   2
@@ -411,7 +420,6 @@
 }
 
 
-extern "C" {
 BOOL LogStart()
 {
 	LONG Option;
@@ -677,7 +685,6 @@
 
 	return TRUE;
 }
-}
 
 void LogPut1(BYTE b)
 {
@@ -1084,7 +1091,6 @@
 	cv.BCount = 0;
 }
 
-extern "C" {
 void FileSendStart()
 {
 	LONG Option = 0;
@@ -1152,7 +1158,6 @@
 
 	if (! OpenFTDlg(SendVar))
 		FileTransEnd(OpSendFile);
-	}
 }
 
 void FileTransEnd(WORD OpId)
@@ -1210,7 +1215,6 @@
 		return CommTextEcho(&cv,(PCHAR)&b,1);
 }
 
-extern "C" {
 // \x88ȉ\xBA\x82̎\x9E\x82͂\xB1\x82\xBF\x82\xE7\x82̊֐\x94\x82\xF0\x8Eg\x82\xA4
 // - BinaryMode == true
 // - FileBracketMode == false
@@ -1271,9 +1275,7 @@
 
 	FileTransEnd(OpSendFile);
 }
-}
 
-extern "C" {
 void FileSend()
 {
 	WORD c, fc;
@@ -1377,23 +1379,18 @@
 
 	FileTransEnd(OpSendFile);
 }
-}
 
-extern "C" {
 void FLogChangeButton(BOOL Pause)
 {
 	if (FLogDlg!=NULL)
 		FLogDlg->ChangeButton(Pause);
 }
-}
 
-extern "C" {
 void FLogRefreshNum()
 {
 	if (FLogDlg!=NULL)
 		FLogDlg->RefreshNum();
 }
-}
 
 BOOL OpenProtoDlg(PFileVar fv, int IdProto, int Mode, WORD Opt1, WORD Opt2)
 {
@@ -1466,7 +1463,6 @@
 	return TRUE;
 }
 
-extern "C" {
 void CloseProtoDlg()
 {
 	if (PtDlg!=NULL)
@@ -1488,7 +1484,6 @@
 		}
 	}
 }
-}
 
 BOOL ProtoStart()
 {
@@ -1534,7 +1529,6 @@
 	FreeFileVar(&FileVar);
 }
 
-extern "C" {
 int ProtoDlgParse()
 {
 	int P;
@@ -1551,17 +1545,13 @@
 	}
 	return P;
 }
-}
 
-extern "C" {
 void ProtoDlgTimeOut()
 {
 	if (PtDlg!=NULL)
 		(*ProtoTimeOutProc)(ProtoId,FileVar,ProtoVar,&cv);
 }
-}
 
-extern "C" {
 void ProtoDlgCancel()
 {
 	if ((PtDlg!=NULL) &&
@@ -1568,9 +1558,7 @@
 	    (*ProtoCancel)(ProtoId,FileVar,ProtoVar,&cv))
 		ProtoEnd();
 }
-}
 
-extern "C" {
 void KermitStart(int mode)
 {
 	WORD w;
@@ -1625,9 +1613,7 @@
 	if (! OpenProtoDlg(FileVar,PROTO_KMT,mode,0,0))
 		ProtoEnd();
 }
-}
 
-extern "C" {
 void XMODEMStart(int mode)
 {
 	LONG Option;
@@ -1712,9 +1698,7 @@
 	                   ts.XmodemOpt,ts.XmodemBin))
 		ProtoEnd();
 }
-}
 
-extern "C" {
 void YMODEMStart(int mode)
 {
 	WORD Opt;
@@ -1756,9 +1740,7 @@
 	if (! OpenProtoDlg(FileVar,PROTO_YM,mode,Opt,0))
 		ProtoEnd();
 }
-}
 
-extern "C" {
 void ZMODEMStart(int mode)
 {
 	WORD Opt;
@@ -1797,9 +1779,7 @@
 	if (! OpenProtoDlg(FileVar,PROTO_ZM,mode,Opt,0))
 		ProtoEnd();
 }
-}
 
-extern "C" {
 void BPStart(int mode)
 {
 	LONG Option = 0;
@@ -1832,9 +1812,7 @@
 	if (! OpenProtoDlg(FileVar,PROTO_BP,mode,0,0))
 		ProtoEnd();
 }
-}
 
-extern "C" {
 void QVStart(int mode)
 {
 	WORD W;
@@ -1868,4 +1846,3 @@
 	if (! OpenProtoDlg(FileVar,PROTO_QV,mode,0,0))
 		ProtoEnd();
 }
-}

Modified: branches/cmake/teraterm/teraterm/ftdlg.cpp
===================================================================
--- branches/cmake/teraterm/teraterm/ftdlg.cpp	2018-11-17 15:43:03 UTC (rev 7262)
+++ branches/cmake/teraterm/teraterm/ftdlg.cpp	2018-11-17 15:43:21 UTC (rev 7263)
@@ -31,6 +31,7 @@
 #include <stdio.h>
 #include <windows.h>
 #include <commctrl.h>
+#include <tchar.h>
 #include "teraterm.h"
 #include "tttypes.h"
 #include "ttftypes.h"
@@ -39,6 +40,11 @@
 #include "tt_res.h"
 #include "ftdlg.h"
 
+#undef SetDlgItemText
+#define SetDlgItemText SetDlgItemTextA
+#undef SetWindowText
+#define SetWindowText SetWindowTextA
+
 /////////////////////////////////////////////////////////////////////////////
 // CFileTransDlg dialog
 
@@ -63,7 +69,7 @@
 	wc.hCursor = LoadCursor(NULL,IDC_ARROW);
 	wc.hbrBackground = (HBRUSH)(COLOR_BTNFACE+1);
 	wc.lpszMenuName = NULL;
-	wc.lpszClassName = "FTDlg32";
+	wc.lpszClassName = _T("FTDlg32");
 	RegisterClass(&wc);
 
 	Pause = FALSE;

Modified: branches/cmake/teraterm/teraterm/sizetip.c
===================================================================
--- branches/cmake/teraterm/teraterm/sizetip.c	2018-11-17 15:43:03 UTC (rev 7262)
+++ branches/cmake/teraterm/teraterm/sizetip.c	2018-11-17 15:43:21 UTC (rev 7263)
@@ -61,6 +61,7 @@
 
 #include <windows.h>
 #include <stdio.h>
+#include <tchar.h>
 
 //
 // \x83\x8A\x83T\x83C\x83Y\x83c\x81[\x83\x8B\x83`\x83b\x83v (based on PuTTY sizetip.c)
@@ -134,7 +135,7 @@
 				HDC hdc = CreateCompatibleDC(NULL);
 
 				SelectObject(hdc, tip_font);
-				GetTextExtentPoint32(hdc, str, strlen(str), &sz);
+				GetTextExtentPoint32(hdc, str, _tcslen(str), &sz);
 
 				SetWindowPos(hWnd, NULL, 0, 0, sz.cx + 6, sz.cy + 6,
 				             SWP_NOZORDER | SWP_NOMOVE | SWP_NOACTIVATE);
@@ -171,7 +172,7 @@
 			wc.hCursor = NULL;
 			wc.hbrBackground = NULL;
 			wc.lpszMenuName = NULL;
-			wc.lpszClassName = "SizeTipClass";
+			wc.lpszClassName = _T("SizeTipClass");
 
 			tip_class = RegisterClass(&wc);
 		}
@@ -197,7 +198,7 @@
 
 	/* Generate the tip text */
 
-	sprintf_s(str, sizeof(str), "%dx%d", cx, cy);
+	_stprintf_s(str, _countof(str), _T("%dx%d"), cx, cy);
 
 	if (!tip_wnd) {
 		HDC hdc;
@@ -209,7 +210,7 @@
 		/* calculate the tip's size */
 
 		hdc = CreateCompatibleDC(NULL);
-		GetTextExtentPoint32(hdc, str, strlen(str), &sz);
+		GetTextExtentPoint32(hdc, str, _tcslen(str), &sz);
 		DeleteDC(hdc);
 
 		GetWindowRect(src, &wr);

Modified: branches/cmake/teraterm/teraterm/tekwin.cpp
===================================================================
--- branches/cmake/teraterm/teraterm/tekwin.cpp	2018-11-17 15:43:03 UTC (rev 7262)
+++ branches/cmake/teraterm/teraterm/tekwin.cpp	2018-11-17 15:43:21 UTC (rev 7263)
@@ -44,12 +44,22 @@
 #include "tekwin.h"
 #include "ttlib.h"
 #include "htmlhelp.h"
+#include <tchar.h>
 
 #define CWnd	TTCWnd
 #define CFrameWnd	TTCFrameWnd
 
-#define TEKClassName "TEKWin32"
+#undef GetMenuString
+#define GetMenuString GetMenuStringA
+#undef ModifyMenu
+#define ModifyMenu ModifyMenuA
+#undef InsertMenu
+#define InsertMenu InsertMenuA
+#undef AppendMenu
+#define AppendMenu AppendMenuA
 
+#define TEKClassName _T("TEKWin32")
+
 #ifdef _DEBUG
 #define new DEBUG_NEW
 #undef THIS_FILE
@@ -107,7 +117,7 @@
 		rect.right = rect.left + 640; //temporary width
 		rect.bottom = rect.top + 400; //temporary height
 	}
-	Create(hInst, TEKClassName, "Tera Term", Style, rect, ::GetDesktopWindow(), NULL);
+	Create(hInst, TEKClassName, _T("Tera Term"), Style, rect, ::GetDesktopWindow(), NULL);
 //--------------------------------------------------------
 	HTEKWin = GetSafeHwnd();
 	if (HTEKWin == NULL) {

Modified: branches/cmake/teraterm/teraterm/teraprn.cpp
===================================================================
--- branches/cmake/teraterm/teraterm/teraprn.cpp	2018-11-17 15:43:03 UTC (rev 7262)
+++ branches/cmake/teraterm/teraterm/teraprn.cpp	2018-11-17 15:43:21 UTC (rev 7263)
@@ -55,7 +55,7 @@
 static PRINTDLG PrnDlg;
 
 static HDC PrintDC;
-static LOGFONT Prnlf;
+static LOGFONTA Prnlf;
 static HFONT PrnFont[AttrFontMask+1];
 static int PrnFW, PrnFH;
 static RECT Margin;
@@ -97,7 +97,6 @@
 	}
 }
 
-extern "C" {
 HDC PrnBox(HWND HWin, PBOOL Sel)
 {
 	/* initialize PrnDlg record */
@@ -123,12 +122,10 @@
 	*Sel = (PrnDlg.Flags & PD_SELECTION) != 0;
 	return PrintDC;
 }
-}
 
-extern "C" {
 BOOL PrnStart(LPSTR DocumentName)
 {
-	DOCINFO Doc;
+	DOCINFOA Doc;
 	char DocName[50];
 	CWnd* pParent;
 
@@ -150,13 +147,13 @@
 
 	SetAbortProc(PrintDC,PrnAbortProc);
 
-	Doc.cbSize = sizeof(DOCINFO);
+	Doc.cbSize = sizeof(Doc);
 	strncpy_s(DocName,sizeof(DocName),DocumentName,_TRUNCATE);
 	Doc.lpszDocName = DocName;
 	Doc.lpszOutput = NULL;
 	Doc.lpszDatatype = NULL;
 	Doc.fwType = 0;
-	if (StartDoc(PrintDC, &Doc) > 0) {
+	if (StartDocA(PrintDC, &Doc) > 0) {
 		Printing = TRUE;
 	}
 	else {
@@ -168,9 +165,7 @@
 	}
 	return Printing;
 }
-}
 
-extern "C" {
 void PrnStop()
 {
 	if (Printing) {
@@ -184,7 +179,6 @@
 		HPrnAbortDlg = NULL;
 	}
 }
-}
 
 extern "C" {
 int VTPrintInit(int PrnFlag)
@@ -251,7 +245,7 @@
 	                 (int)((float)ts.PrnMargin[3] / 100.0 * (float)PPI.y);
 
 	/* create test font */
-	memset(&Prnlf, 0, sizeof(LOGFONT));
+	memset(&Prnlf, 0, sizeof(Prnlf));
 
 	if (ts.PrnFont[0]==0) {
 		Prnlf.lfHeight = ts.VTFontSize.y;
@@ -274,7 +268,7 @@
 	Prnlf.lfQuality = DEFAULT_QUALITY;
 	Prnlf.lfPitchAndFamily = FIXED_PITCH | FF_DONTCARE;
 
-	PrnFont[0] = CreateFontIndirect(&Prnlf);
+	PrnFont[0] = CreateFontIndirectA(&Prnlf);
 
 	DC = GetDC(HVTWin);
 	SelectObject(DC, PrnFont[0]);
@@ -293,7 +287,7 @@
 	/* Normal Font */
 	Prnlf.lfWeight = FW_NORMAL;
 	Prnlf.lfUnderline = 0;
-	PrnFont[0] = CreateFontIndirect(&Prnlf);
+	PrnFont[0] = CreateFontIndirectA(&Prnlf);
 	SelectObject(PrintDC,PrnFont[0]);
 	GetTextMetrics(PrintDC, &Metrics);
 	PrnFW = Metrics.tmAveCharWidth;
@@ -300,16 +294,16 @@
 	PrnFH = Metrics.tmHeight;
 	/* Under line */
 	Prnlf.lfUnderline = 1;
-	PrnFont[AttrUnder] = CreateFontIndirect(&Prnlf);
+	PrnFont[AttrUnder] = CreateFontIndirectA(&Prnlf);
 
 	if (ts.FontFlag & FF_BOLD) {
 		/* Bold */
 		Prnlf.lfUnderline = 0;
 		Prnlf.lfWeight = FW_BOLD;
-		PrnFont[AttrBold] = CreateFontIndirect(&Prnlf);
+		PrnFont[AttrBold] = CreateFontIndirectA(&Prnlf);
 		/* Bold + Underline */
 		Prnlf.lfUnderline = 1;
-		PrnFont[AttrBold | AttrUnder] = CreateFontIndirect(&Prnlf);
+		PrnFont[AttrBold | AttrUnder] = CreateFontIndirectA(&Prnlf);
 	}
 	else {
 		PrnFont[AttrBold] = PrnFont[AttrDefault];
@@ -323,7 +317,7 @@
 	Prnlf.lfCharSet = SYMBOL_CHARSET;
 
 	strncpy_s(Prnlf.lfFaceName, sizeof(Prnlf.lfFaceName),"Tera Special", _TRUNCATE);
-	PrnFont[AttrSpecial] = CreateFontIndirect(&Prnlf);
+	PrnFont[AttrSpecial] = CreateFontIndirectA(&Prnlf);
 	PrnFont[AttrSpecial | AttrBold] = PrnFont[AttrSpecial];
 	PrnFont[AttrSpecial | AttrUnder] = PrnFont[AttrSpecial];
 	PrnFont[AttrSpecial | AttrBold | AttrUnder] = PrnFont[AttrSpecial];
@@ -427,7 +421,7 @@
 			Ptr2 = Ptr;
 			do {
 				Ptr1 = Ptr2;
-				Ptr2 = CharNext(Ptr1);
+				Ptr2 = CharNextA(Ptr1);
 			} while ((Ptr2!=NULL) && ((Ptr2-Ptr)<=i));
 			i = Ptr1-Ptr;
 			if (i<=0) {
@@ -439,7 +433,7 @@
 		RText.right = PrnX + i*PrnFW;
 		RText.top = PrnY;
 		RText.bottom = PrnY+PrnFH;
-		ExtTextOut(PrintDC,PrnX,PrnY,6,&RText,Ptr,i,&PrnDx[0]);
+		ExtTextOutA(PrintDC,PrnX,PrnY,6,&RText,Ptr,i,&PrnDx[0]);
 		PrnX = RText.right;
 		Count=Count-i;
 		Ptr = Ptr + i;
@@ -491,8 +485,8 @@
 		return;
 	}
 	if (PrnFName[0] == 0) {
-		GetTempPath(sizeof(Temp),Temp);
-		if (GetTempFileName(Temp,"tmp",0,PrnFName)==0) {
+		GetTempPathA(sizeof(Temp),Temp);
+		if (GetTempFileNameA(Temp,"tmp",0,PrnFName)==0) {
 			return;
 		}
 		HPrnFile = _lcreat(PrnFName,0);

Modified: branches/cmake/teraterm/teraterm/teraterm.cpp
===================================================================
--- branches/cmake/teraterm/teraterm/teraterm.cpp	2018-11-17 15:43:03 UTC (rev 7262)
+++ branches/cmake/teraterm/teraterm/teraterm.cpp	2018-11-17 15:43:21 UTC (rev 7263)
@@ -58,7 +58,7 @@
 	pSetDllDir setDllDir;
 	pSetDefDllDir setDefDllDir;
 
-	if ((module = GetModuleHandle("kernel32.dll")) != NULL) {
+	if ((module = GetModuleHandleA("kernel32.dll")) != NULL) {
 		if ((setDefDllDir = (pSetDefDllDir)GetProcAddress(module, "SetDefaultDllDirectories")) != NULL) {
 			// SetDefaultDllDirectories() が使える場合は、検索パスを %WINDOWS%\system32 のみに設定する
 			(*setDefDllDir)((DWORD)0x00000800); // LOAD_LIBRARY_SEARCH_SYSTEM32
@@ -221,7 +221,7 @@
 
 static void SetDialogFont()
 {
-	LOGFONT logfont;
+	LOGFONTA logfont;
 	BOOL result;
 
 	// 明示的に指定されている場合はそれに従う

Modified: branches/cmake/teraterm/teraterm/ttdde.c
===================================================================
--- branches/cmake/teraterm/teraterm/ttdde.c	2018-11-17 15:43:03 UTC (rev 7262)
+++ branches/cmake/teraterm/teraterm/ttdde.c	2018-11-17 15:43:21 UTC (rev 7263)
@@ -28,6 +28,8 @@
  */
 
 /* TERATERM.EXE, DDE routines */
+#undef UNICODE
+#undef _UNICODE
 #include "teraterm.h"
 #include "tttypes.h"
 #include <stdio.h>

Modified: branches/cmake/teraterm/teraterm/ttdialog.c
===================================================================
--- branches/cmake/teraterm/teraterm/ttdialog.c	2018-11-17 15:43:03 UTC (rev 7262)
+++ branches/cmake/teraterm/teraterm/ttdialog.c	2018-11-17 15:43:21 UTC (rev 7263)
@@ -34,6 +34,7 @@
 #include "ttdlg.h"
 
 #include "ttdialog.h"
+#include "ttwinman.h"
 
 PSetupTerminal SetupTerminal = _SetupTerminal;
 PSetupWin SetupWin = _SetupWin;
@@ -52,6 +53,7 @@
 {
 	static BOOL initialized;
 	if (!initialized) {
+		TTDLGSetUILanguageFile(ts.UILanguageFile);
 		TTXGetUIHooks(); /* TTPLUG */
 		initialized = TRUE;
 	}

Modified: branches/cmake/teraterm/teraterm/ttdialog.h
===================================================================
--- branches/cmake/teraterm/teraterm/ttdialog.h	2018-11-17 15:43:03 UTC (rev 7262)
+++ branches/cmake/teraterm/teraterm/ttdialog.h	2018-11-17 15:43:21 UTC (rev 7263)
@@ -49,7 +49,7 @@
 typedef BOOL (WINAPI *PAboutDialog)
   (HWND WndParent);
 typedef BOOL (WINAPI *PChooseFontDlg)
-  (HWND WndParent, LPLOGFONT LogFont, PTTSet ts);
+  (HWND WndParent, LPLOGFONTA LogFont, PTTSet ts);
 typedef BOOL (WINAPI *PSetupGeneral)
   (HWND WndParent, PTTSet ts);
 typedef BOOL (WINAPI *PWindowWindow)

Modified: branches/cmake/teraterm/teraterm/ttime.c
===================================================================
--- branches/cmake/teraterm/teraterm/ttime.c	2018-11-17 15:43:03 UTC (rev 7262)
+++ branches/cmake/teraterm/teraterm/ttime.c	2018-11-17 15:43:21 UTC (rev 7263)
@@ -74,7 +74,7 @@
 
 
 static HANDLE HIMEDLL = NULL;
-static LOGFONT lfIME;
+static LOGFONTA lfIME;
 
 
 BOOL LoadIME()
@@ -87,15 +87,15 @@
   char imm32_dll[MAX_PATH];
 
   if (HIMEDLL != NULL) return TRUE;
-  GetSystemDirectory(imm32_dll, sizeof(imm32_dll));
+  GetSystemDirectoryA(imm32_dll, sizeof(imm32_dll));
   strncat_s(imm32_dll, sizeof(imm32_dll), "\\imm32.dll", _TRUNCATE);
-  HIMEDLL = LoadLibrary(imm32_dll);
+  HIMEDLL = LoadLibraryA(imm32_dll);
   if (HIMEDLL == NULL)
   {
     get_lang_msg("MSG_TT_ERROR", uimsg, sizeof(uimsg),  "Tera Term: Error", ts.UILanguageFile);
     get_lang_msg("MSG_USE_IME_ERROR", ts.UIMsg, sizeof(ts.UIMsg), "Can't use IME", ts.UILanguageFile);
-    MessageBox(0,ts.UIMsg,uimsg,MB_ICONEXCLAMATION);
-    WritePrivateProfileString("Tera Term","IME","off",ts.SetupFName);
+    MessageBoxA(0,ts.UIMsg,uimsg,MB_ICONEXCLAMATION);
+    WritePrivateProfileStringA("Tera Term","IME","off",ts.SetupFName);
     ts.UseIME = 0;
 #if 0
     tempts = (PTTSet)malloc(sizeof(TTTSet));
@@ -192,9 +192,9 @@
   (*PImmReleaseContext)(HVTWin,hIMC);
 }
 
-void SetConversionLogFont(PLOGFONT lf)
+void SetConversionLogFont(PLOGFONTA lf)
 {
-  memcpy(&lfIME,lf,sizeof(LOGFONT));
+  memcpy(&lfIME,lf,sizeof(*lf));
 }
 
 HGLOBAL GetConvString(UINT wParam, LPARAM lParam)

Modified: branches/cmake/teraterm/teraterm/ttime.h
===================================================================
--- branches/cmake/teraterm/teraterm/ttime.h	2018-11-17 15:43:03 UTC (rev 7262)
+++ branches/cmake/teraterm/teraterm/ttime.h	2018-11-17 15:43:21 UTC (rev 7263)
@@ -38,7 +38,7 @@
 void FreeIME();
 BOOL CanUseIME();
 void SetConversionWindow(HWND HWin, int X, int Y);
-void SetConversionLogFont(PLOGFONT lf);
+void SetConversionLogFont(PLOGFONTA lf);
 BOOL GetIMEOpenStatus(void);
 void SetIMEOpenStatus(BOOL stat);
 

Modified: branches/cmake/teraterm/teraterm/ttplug.c
===================================================================
--- branches/cmake/teraterm/teraterm/ttplug.c	2018-11-17 15:43:03 UTC (rev 7262)
+++ branches/cmake/teraterm/teraterm/ttplug.c	2018-11-17 15:43:21 UTC (rev 7263)
@@ -70,7 +70,7 @@
   char uimsg[MAX_UIMSG];
 
   if (NumExtensions>=MAXNUMEXTENSIONS) return;
-  LibHandle[NumExtensions] = LoadLibrary(fileName);
+  LibHandle[NumExtensions] = LoadLibraryA(fileName);
   if (LibHandle[NumExtensions] != NULL) {
 #if defined(_MSC_VER)
     const char *TTXBIND = "_TTXBind @ 8";
@@ -106,7 +106,7 @@
   get_lang_msg("MSG_TT_ERROR", uimsg, sizeof(uimsg), "Tera Term: Error", ts.UILanguageFile);
   get_lang_msg("MSG_LOAD_EXT_ERROR", ts.UIMsg, sizeof(ts.UIMsg), "Cannot load extension %s (%d)", ts.UILanguageFile);
   _snprintf_s(buf, sizeof(buf), _TRUNCATE, ts.UIMsg, fileName, err);
-  MessageBox(NULL, buf, uimsg, MB_OK | MB_ICONEXCLAMATION);
+  MessageBoxA(NULL, buf, uimsg, MB_OK | MB_ICONEXCLAMATION);
 }
 
 void WINAPI TTXInit(PTTSet ts, PComVar cv) {

Modified: branches/cmake/teraterm/teraterm/ttwinman.c
===================================================================
--- branches/cmake/teraterm/teraterm/ttwinman.c	2018-11-17 15:43:03 UTC (rev 7262)
+++ branches/cmake/teraterm/teraterm/ttwinman.c	2018-11-17 15:43:21 UTC (rev 7263)
@@ -249,7 +249,7 @@
 	if ((ts.TitleFormat & 4)!=0) // VT
 		strncat_s(TempTitle,sizeof(TempTitle)," VT",_TRUNCATE);
 
-	SetWindowText(HVTWin,TempTitle);
+	SetWindowTextA(HVTWin,TempTitle);
 
 	if (HTEKWin!=0)
 	{
@@ -257,7 +257,7 @@
 		{
 			strncat_s(TempTitle,sizeof(TempTitle)," TEK",_TRUNCATE);
 		}
-		SetWindowText(HTEKWin,TempTitle);
+		SetWindowTextA(HTEKWin,TempTitle);
 	}
 }
 
@@ -305,5 +305,5 @@
 {
 	char DLLpath[MAX_PATH];
 	_snprintf_s(DLLpath, sizeof(DLLpath), _TRUNCATE, "%s\\%s", ts.HomeDir, DLLname);
-	return LoadLibrary(DLLpath);
+	return LoadLibraryA(DLLpath);
 }

Modified: branches/cmake/teraterm/teraterm/ttwsk.c
===================================================================
--- branches/cmake/teraterm/teraterm/ttwsk.c	2018-11-17 15:43:03 UTC (rev 7262)
+++ branches/cmake/teraterm/teraterm/ttwsk.c	2018-11-17 15:43:21 UTC (rev 7263)
@@ -28,7 +28,8 @@
  */
 
 /* TERATERM.EXE, Winsock interface */
-
+#undef UNICODE
+#undef _UNICODE
 #include "teraterm.h"
 #include "ttwsk.h"
 #include "WSAAsyncGetAddrInfo.h"

Modified: branches/cmake/teraterm/teraterm/vtdisp.c
===================================================================
--- branches/cmake/teraterm/teraterm/vtdisp.c	2018-11-17 15:43:03 UTC (rev 7262)
+++ branches/cmake/teraterm/teraterm/vtdisp.c	2018-11-17 15:43:21 UTC (rev 7263)
@@ -43,6 +43,9 @@
 #include <locale.h>
 #include <olectl.h>
 
+#undef CreateFontIndirect
+#define CreateFontIndirect CreateFontIndirectA
+
 #define CurWidth 2
 
 static const BYTE DefaultColorTable[256][3] = {
@@ -327,7 +330,7 @@
   DeleteObject(hBrush);
 }
 
-static void RandomFile(const TCHAR *filespec_src, TCHAR *filename, int destlen)
+static void RandomFile(const char *filespec_src, char *filename, int destlen)
 {
   int    i;
   int    file_num;
@@ -335,17 +338,17 @@
   char   *filePart;
   char filespec[1024];
   HANDLE hFind;
-  WIN32_FIND_DATA fd;
+  WIN32_FIND_DATAA fd;
 
   filename[0] = 0;
-  ExpandEnvironmentStrings(filespec_src, filespec, sizeof(filespec));
+  ExpandEnvironmentStringsA(filespec_src, filespec, sizeof(filespec));
 
   //\x90\xE2\x91΃p\x83X\x82ɕϊ\xB7
-  if(!GetFullPathName(filespec,MAX_PATH,fullpath,&filePart))
+  if(!GetFullPathNameA(filespec,MAX_PATH,fullpath,&filePart))
     return;
 
   //\x83t\x83@\x83C\x83\x8B\x82𐔂\xA6\x82\xE9
-  hFind = FindFirstFile(fullpath,&fd);
+  hFind = FindFirstFileA(fullpath,&fd);
 
   file_num = 0;
 
@@ -357,7 +360,7 @@
       if(!(fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY))
         file_num ++;
 
-    }while(FindNextFile(hFind,&fd));
+    }while(FindNextFileA(hFind,&fd));
 
   }
 
@@ -369,7 +372,7 @@
   //\x89\xBD\x94Ԗڂ̃t\x83@\x83C\x83\x8B\x82ɂ\xB7\x82邩\x8C\x88\x82߂\xE9\x81B
   file_num = rand()%file_num + 1;
 
-  hFind = FindFirstFile(fullpath,&fd);
+  hFind = FindFirstFileA(fullpath,&fd);
 
   if(hFind != INVALID_HANDLE_VALUE)
   {
@@ -380,7 +383,7 @@
       if(!(fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY))
         i ++;
 
-    }while(i < file_num && FindNextFile(hFind,&fd));
+    }while(i < file_num && FindNextFileA(hFind,&fd));
 
   }else{
     return;
@@ -419,7 +422,7 @@
   hSPI = NULL;
 
   //SPI \x82\xF0\x83\x8D\x81[\x83h
-  hSPI = LoadLibrary(nameSPI);
+  hSPI = LoadLibraryA(nameSPI);
 
   if(!hSPI)
     goto error;
@@ -460,7 +463,7 @@
   HANDLE hFile;
   BITMAPFILEHEADER bfh;
 
-  hFile = CreateFile(nameFile,GENERIC_WRITE,0,NULL,CREATE_ALWAYS,FILE_ATTRIBUTE_NORMAL,NULL);
+  hFile = CreateFileA(nameFile,GENERIC_WRITE,0,NULL,CREATE_ALWAYS,FILE_ATTRIBUTE_NORMAL,NULL);
 
   if(hFile == INVALID_HANDLE_VALUE)
     return FALSE;
@@ -548,7 +551,7 @@
   HBITMAP hbm;
   HANDLE  hPictureFile;
   HANDLE  hFind;
-  WIN32_FIND_DATA fd;
+  WIN32_FIND_DATAA fd;
 
   #ifdef _DEBUG
     OutputDebugPrintf("Preload Picture : %s\n",src->file);
@@ -555,7 +558,7 @@
   #endif
 
   //\x83t\x83@\x83C\x83\x8B\x82\xF0\x93ǂݍ\x9E\x82\xDE
-  hPictureFile = CreateFile(src->file,GENERIC_READ,0,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL);
+  hPictureFile = CreateFileA(src->file,GENERIC_READ,0,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL);
 
   if(hPictureFile == INVALID_HANDLE_VALUE)
     return;
@@ -573,11 +576,11 @@
   CloseHandle(hPictureFile);
 
   // SPIPath \x82\xF0\x90\xE2\x91΃p\x83X\x82ɕϊ\xB7
-  if(!GetFullPathName(BGSPIPath,MAX_PATH,filespec,&filePart))
+  if(!GetFullPathNameA(BGSPIPath,MAX_PATH,filespec,&filePart))
     return;
 
   //\x83v\x83\x89\x83O\x83C\x83\x93\x82𓖂\xBD\x82\xC1\x82Ă\xA2\x82\xAD
-  hFind = FindFirstFile(filespec,&fd);
+  hFind = FindFirstFileA(filespec,&fd);
 
   if(hFind != INVALID_HANDLE_VALUE && filePart)
   {
@@ -614,7 +617,7 @@
 
         break;
       }
-    }while(FindNextFile(hFind,&fd));
+    }while(FindNextFileA(hFind,&fd));
 
     FindClose(hFind);
   }
@@ -623,7 +626,7 @@
 
   if (IsLoadImageOnlyEnabled()) {
     //\x89摜\x82\xF0\x83r\x83b\x83g\x83}\x83b\x83v\x82Ƃ\xB5\x82ēǂݍ\x9E\x82\xDD
-    hbm = LoadImage(0,src->file,IMAGE_BITMAP,0,0,LR_LOADFROMFILE);
+    hbm = LoadImageA(0,src->file,IMAGE_BITMAP,0,0,LR_LOADFROMFILE);
 
   } else {
 	  // Susie plugin\x82œǂݍ\x9E\x82߂Ȃ\xA2JPEG\x83t\x83@\x83C\x83\x8B\x82\xAA\x91\xB6\x8D݂\xB5\x82\xBD\x8Fꍇ\x81A
@@ -658,21 +661,21 @@
   strncpy_s(wi->filename, sizeof(wi->filename),"", _TRUNCATE);
 
   //\x83\x8C\x83W\x83X\x83g\x83\x8A\x83L\x81[\x82̃I\x81[\x83v\x83\x93
-  if(RegOpenKeyEx(HKEY_CURRENT_USER, "Control Panel\\Desktop", 0, KEY_READ, &hKey) != ERROR_SUCCESS)
+  if(RegOpenKeyExA(HKEY_CURRENT_USER, "Control Panel\\Desktop", 0, KEY_READ, &hKey) != ERROR_SUCCESS)
     return;
 
   //\x95ǎ\x86\x96\xBC\x83Q\x83b\x83g
   length = MAX_PATH;
-  RegQueryValueEx(hKey,"Wallpaper"     ,NULL,NULL,(BYTE*)(wi->filename),&length);
+  RegQueryValueExA(hKey,"Wallpaper"     ,NULL,NULL,(BYTE*)(wi->filename),&length);
 
   //\x95ǎ\x86\x83X\x83^\x83C\x83\x8B\x83Q\x83b\x83g
   length = 256;
-  RegQueryValueEx(hKey,"WallpaperStyle",NULL,NULL,(BYTE*)str,&length);
+  RegQueryValueExA(hKey,"WallpaperStyle",NULL,NULL,(BYTE*)str,&length);
   style = atoi(str);
 
   //\x95ǎ\x86\x83X\x83^\x83C\x83\x8B\x83Q\x83b\x83g
   length = 256;
-  RegQueryValueEx(hKey,"TileWallpaper" ,NULL,NULL,(BYTE*)str,&length);
+  RegQueryValueExA(hKey,"TileWallpaper" ,NULL,NULL,(BYTE*)str,&length);
   tile = atoi(str);
 
   //\x82\xB1\x82\xEA\x82ł\xA2\x82\xA2\x82́H
@@ -718,7 +721,7 @@
 	short type;
 	HBITMAP hBitmap = NULL;
 
-	hFile=CreateFile(File,GENERIC_READ,0,NULL,OPEN_EXISTING,0,NULL);
+	hFile=CreateFileA(File,GENERIC_READ,0,NULL,OPEN_EXISTING,0,NULL);
 	if (hFile == INVALID_HANDLE_VALUE) {
 		return (hBitmap);
 	}
@@ -872,10 +875,10 @@
 		//\x95ǎ\x86\x82\xF0\x93ǂݍ\x9E\x82\xDD
 		//LR_CREATEDIBSECTION \x82\xF0\x8Ew\x92肷\x82\xE9\x82̂\xAA\x83R\x83c
 		if (wi.pattern == BG_STRETCH) {
-			hbm = LoadImage(0,wi.filename,IMAGE_BITMAP,CRTWidth,CRTHeight,LR_LOADFROMFILE | LR_CREATEDIBSECTION);
+			hbm = LoadImageA(0,wi.filename,IMAGE_BITMAP,CRTWidth,CRTHeight,LR_LOADFROMFILE | LR_CREATEDIBSECTION);
 		}
 		else {
-			hbm = LoadImage(0,wi.filename,IMAGE_BITMAP,        0,       0,LR_LOADFROMFILE);
+			hbm = LoadImageA(0,wi.filename,IMAGE_BITMAP,        0,       0,LR_LOADFROMFILE);
 		}
 	}
 	else {
@@ -985,7 +988,7 @@
 			HBITMAP hbm;
 
 			if (IsLoadImageOnlyEnabled()) {
-				hbm = LoadImage(0,src->file,IMAGE_BITMAP,width,height,LR_LOADFROMFILE);
+				hbm = LoadImageA(0,src->file,IMAGE_BITMAP,width,height,LR_LOADFROMFILE);
 			} else {
 				HBITMAP newhbm;
 				hbm = GetBitmapHandle(src->file);
@@ -1272,7 +1275,7 @@
 
   _snprintf_s(defstr,sizeof(defstr),_TRUNCATE,"%d,%d,%d",GetRValue(defcolor),GetGValue(defcolor),GetBValue(defcolor));
 
-  GetPrivateProfileString(BG_SECTION,name,defstr,colorstr,255,file);
+  GetPrivateProfileStringA(BG_SECTION,name,defstr,colorstr,255,file);
 
   r = g = b = 0;
 
@@ -1289,7 +1292,7 @@
   def %= nList;
 
   strncpy_s(defstr, sizeof(defstr),strList[def], _TRUNCATE);
-  GetPrivateProfileString(BG_SECTION,name,defstr,str,64,file);
+  GetPrivateProfileStringA(BG_SECTION,name,defstr,str,64,file);
 
   for(i = 0;i < nList;i++)
     if(!_stricmp(str,strList[i]))
@@ -1365,27 +1368,27 @@
   BGDest.pattern = BGGetPattern("BGPicturePattern",BGSrc1.pattern,file);
   BGDest.color   = BGGetColor("BGPictureBaseColor",BGSrc1.color,file);
 
-  GetPrivateProfileString(BG_SECTION,"BGPictureFile",BGSrc1.file,path,MAX_PATH,file);
+  GetPrivateProfileStringA(BG_SECTION,"BGPictureFile",BGSrc1.file,path,MAX_PATH,file);
   RandomFile(path,BGDest.file,sizeof(BGDest.file));
 
-  BGSrc1.alpha   = 255 - GetPrivateProfileInt(BG_SECTION,"BGPictureTone",255 - BGSrc1.alpha,file);
+  BGSrc1.alpha   = 255 - GetPrivateProfileIntA(BG_SECTION,"BGPictureTone",255 - BGSrc1.alpha,file);
 
   if(!strcmp(BGDest.file,""))
     BGSrc1.alpha = 255;
 
-  BGSrc2.alpha   = 255 - GetPrivateProfileInt(BG_SECTION,"BGFadeTone",255 - BGSrc2.alpha,file);
+  BGSrc2.alpha   = 255 - GetPrivateProfileIntA(BG_SECTION,"BGFadeTone",255 - BGSrc2.alpha,file);
   BGSrc2.color   = BGGetColor("BGFadeColor",BGSrc2.color,file);
 
-  BGReverseTextAlpha = GetPrivateProfileInt(BG_SECTION,"BGReverseTextTone",BGReverseTextAlpha,file);
+  BGReverseTextAlpha = GetPrivateProfileIntA(BG_SECTION,"BGReverseTextTone",BGReverseTextAlpha,file);
 
   //Src1 \x82̓ǂݏo\x82\xB5
   BGSrc1.type      = BGGetType("BGSrc1Type",BGSrc1.type,file);
   BGSrc1.pattern   = BGGetPattern("BGSrc1Pattern",BGSrc1.pattern,file);
   BGSrc1.antiAlias = BGGetOnOff("BGSrc1AntiAlias",BGSrc1.antiAlias,file);
-  BGSrc1.alpha     = GetPrivateProfileInt(BG_SECTION,"BGSrc1Alpha"  ,BGSrc1.alpha  ,file);
+  BGSrc1.alpha     = GetPrivateProfileIntA(BG_SECTION,"BGSrc1Alpha"  ,BGSrc1.alpha  ,file);
   BGSrc1.color     = BGGetColor("BGSrc1Color",BGSrc1.color,file);
 
-  GetPrivateProfileString(BG_SECTION,"BGSrc1File",BGSrc1.file,path,MAX_PATH,file);
+  GetPrivateProfileStringA(BG_SECTION,"BGSrc1File",BGSrc1.file,path,MAX_PATH,file);
   RandomFile(path,BGSrc1.file,sizeof(BGSrc1.file));
 
   //Src2 \x82̓ǂݏo\x82\xB5
@@ -1392,10 +1395,10 @@
   BGSrc2.type      = BGGetType("BGSrc2Type",BGSrc2.type,file);
   BGSrc2.pattern   = BGGetPattern("BGSrc2Pattern",BGSrc2.pattern,file);
   BGSrc2.antiAlias = BGGetOnOff("BGSrc2AntiAlias",BGSrc2.antiAlias,file);
-  BGSrc2.alpha     = GetPrivateProfileInt(BG_SECTION,"BGSrc2Alpha"  ,BGSrc2.alpha  ,file);
+  BGSrc2.alpha     = GetPrivateProfileIntA(BG_SECTION,"BGSrc2Alpha"  ,BGSrc2.alpha  ,file);
   BGSrc2.color     = BGGetColor("BGSrc2Color",BGSrc2.color,file);
 
-  GetPrivateProfileString(BG_SECTION,"BGSrc2File",BGSrc2.file,path,MAX_PATH,file);
+  GetPrivateProfileStringA(BG_SECTION,"BGSrc2File",BGSrc2.file,path,MAX_PATH,file);
   RandomFile(path,BGSrc2.file,sizeof(BGSrc2.file));
 
   //Dest \x82̓ǂݏo\x82\xB5
@@ -1404,11 +1407,11 @@
   BGDest.antiAlias = BGGetOnOff("BGDestAntiAlias",BGDest.antiAlias,file);
   BGDest.color     = BGGetColor("BGDestColor",BGDest.color,file);
 
-  GetPrivateProfileString(BG_SECTION, BG_DESTFILE, BGDest.file,path,MAX_PATH,file);
+  GetPrivateProfileStringA(BG_SECTION, BG_DESTFILE, BGDest.file,path,MAX_PATH,file);
   RandomFile(path,BGDest.file,sizeof(BGDest.file));
 
   //\x82\xBB\x82̑\xBC\x93ǂݏo\x82\xB5
-  BGReverseTextAlpha = GetPrivateProfileInt(BG_SECTION,"BGReverseTextAlpha",BGReverseTextAlpha,file);
+  BGReverseTextAlpha = GetPrivateProfileIntA(BG_SECTION,"BGReverseTextAlpha",BGReverseTextAlpha,file);
   BGReadTextColorConfig(file);
 }
 
@@ -1425,9 +1428,9 @@
   DeleteBitmapDC(&(BGSrc2.hdc));
 
   //\x83e\x83\x93\x83|\x83\x89\x83\x8A\x81[\x83t\x83@\x83C\x83\x8B\x8D폜
-  DeleteFile(BGDest.fileTmp);
-  DeleteFile(BGSrc1.fileTmp);
-  DeleteFile(BGSrc2.fileTmp);
+  DeleteFileA(BGDest.fileTmp);
+  DeleteFileA(BGSrc1.fileTmp);
+  DeleteFileA(BGSrc2.fileTmp);
 }
 
 void BGInitialize(void)
@@ -1480,21 +1483,21 @@
 	  ts.EtermLookfeel.BGFastSizeMove = BGGetOnOff("BGFastSizeMove"    ,TRUE ,ts.SetupFName);
 	  ts.EtermLookfeel.BGNoCopyBits = BGGetOnOff("BGFlickerlessMove" ,TRUE ,ts.SetupFName);
 
-	  GetPrivateProfileString(BG_SECTION,"BGSPIPath","plugin",BGSPIPath,MAX_PATH,ts.SetupFName);
+	  GetPrivateProfileStringA(BG_SECTION,"BGSPIPath","plugin",BGSPIPath,MAX_PATH,ts.SetupFName);
 	  strncpy_s(ts.EtermLookfeel.BGSPIPath, sizeof(ts.EtermLookfeel.BGSPIPath), BGSPIPath, _TRUNCATE);
 
   if (ts.EtermLookfeel.BGThemeFile[0] == '\0') {
 	  //\x83R\x83\x93\x83t\x83B\x83O\x83t\x83@\x83C\x83\x8B\x82̌\x88\x92\xE8
-	  GetPrivateProfileString(BG_SECTION,"BGThemeFile","",path,MAX_PATH,ts.SetupFName);
+	  GetPrivateProfileStringA(BG_SECTION,"BGThemeFile","",path,MAX_PATH,ts.SetupFName);
 	  strncpy_s(ts.EtermLookfeel.BGThemeFile, sizeof(ts.EtermLookfeel.BGThemeFile), path, _TRUNCATE);
 
 	  // \x94w\x8Ci\x89摜\x82̓ǂݍ\x9E\x82\xDD
 	  _snprintf_s(path, sizeof(path), _TRUNCATE, "%s\\%s", ts.HomeDir, BG_THEME_IMAGEFILE);
-	  GetPrivateProfileString(BG_SECTION, BG_DESTFILE, "", ts.BGImageFilePath, sizeof(ts.BGImageFilePath), path);
+	  GetPrivateProfileStringA(BG_SECTION, BG_DESTFILE, "", ts.BGImageFilePath, sizeof(ts.BGImageFilePath), path);
 
 	  // \x94w\x8Ci\x89摜\x82̖\xBE\x82邳\x82̓ǂݍ\x9E\x82݁B
 	  // BGSrc1Alpha \x82\xC6 BGSrc2Alpha\x82͓\xAF\x92l\x82Ƃ\xB5\x82Ĉ\xB5\x82\xA4\x81B
-	  ts.BGImgBrightness = GetPrivateProfileInt(BG_SECTION, BG_THEME_IMAGE_BRIGHTNESS1, BG_THEME_IMAGE_BRIGHTNESS_DEFAULT, path);
+	  ts.BGImgBrightness = GetPrivateProfileIntA(BG_SECTION, BG_THEME_IMAGE_BRIGHTNESS1, BG_THEME_IMAGE_BRIGHTNESS_DEFAULT, path);
   }
 
   if(!BGEnable)
@@ -1511,10 +1514,10 @@
   BGNoCopyBits = ts.EtermLookfeel.BGNoCopyBits;
 
   //\x83e\x83\x93\x83|\x83\x89\x83\x8A\x81[\x83t\x83@\x83C\x83\x8B\x96\xBC\x82𐶐\xAC
-  GetTempPath(MAX_PATH,tempPath);
-  GetTempFileName(tempPath,"ttAK",0,BGDest.fileTmp);
-  GetTempFileName(tempPath,"ttAK",0,BGSrc1.fileTmp);
-  GetTempFileName(tempPath,"ttAK",0,BGSrc2.fileTmp);
+  GetTempPathA(MAX_PATH,tempPath);
+  GetTempFileNameA(tempPath,"ttAK",0,BGDest.fileTmp);
+  GetTempFileNameA(tempPath,"ttAK",0,BGSrc1.fileTmp);
+  GetTempFileNameA(tempPath,"ttAK",0,BGSrc2.fileTmp);
 
   //\x83f\x83t\x83H\x83\x8B\x83g\x92l
   BGDest.type      = BG_PICTURE;
@@ -1543,7 +1546,7 @@
   BGReadIniFile(ts.SetupFName);
 
   //\x83R\x83\x93\x83t\x83B\x83O\x83t\x83@\x83C\x83\x8B\x82̌\x88\x92\xE8
-  GetPrivateProfileString(BG_SECTION,"BGThemeFile","",path,MAX_PATH,ts.SetupFName);
+  GetPrivateProfileStringA(BG_SECTION,"BGThemeFile","",path,MAX_PATH,ts.SetupFName);
   RandomFile(path,config_file,sizeof(config_file));
 
   //\x90ݒ\xE8\x82̃I\x81[\x83o\x81[\x83\x89\x83C\x83h
@@ -1552,14 +1555,14 @@
     char dir[MAX_PATH],prevDir[MAX_PATH];
 
     //INI\x83t\x83@\x83C\x83\x8B\x82̂\xA0\x82\xE9\x83f\x83B\x83\x8C\x83N\x83g\x83\x8A\x82Ɉꎞ\x93I\x82Ɉړ\xAE
-    GetCurrentDirectory(MAX_PATH,prevDir);
+    GetCurrentDirectoryA(MAX_PATH,prevDir);
 
     ExtractDirName(config_file,dir);
-    SetCurrentDirectory(dir);
+    SetCurrentDirectoryA(dir);
 
     BGReadIniFile(config_file);
 
-    SetCurrentDirectory(prevDir);
+    SetCurrentDirectoryA(prevDir);
   }
 
   //SPI \x82̃p\x83X\x82𐮌`
@@ -1905,9 +1908,9 @@
        *Yw = (Ys - WinOrgY) * FontHeight;
 }
 
-static void SetLogFont(LOGFONT *VTlf)
+static void SetLogFont(LOGFONTA *VTlf)
 {
-  memset(VTlf, 0, sizeof(LOGFONT));
+  memset(VTlf, 0, sizeof(*VTlf));
   VTlf->lfWeight = FW_NORMAL;
   VTlf->lfItalic = 0;
   VTlf->lfUnderline = 0;
@@ -1926,7 +1929,7 @@
 {
   int i, j;
   TEXTMETRIC Metrics;
-  LOGFONT VTlf;
+  LOGFONTA VTlf;
 
   /* Delete Old Fonts */
   for (i = 0 ; i <= AttrFontMask ; i++)
@@ -2033,7 +2036,7 @@
 		if (ts.UseIME>0)
 		{
 			if (ts.IMEInline>0) {
-				LOGFONT VTlf;
+				LOGFONTA VTlf;
 				SetLogFont(&VTlf);
 				SetConversionLogFont(&VTlf);
 			}
@@ -2747,7 +2750,7 @@
 //<!--by AKASI
   if(!BGEnable)
   {
-    ExtTextOut(VTDC,*X+ts.FontDX,Y+ts.FontDY,
+    ExtTextOutA(VTDC,*X+ts.FontDX,Y+ts.FontDY,
                ETO_CLIPPED | ETO_OPAQUE,
                &RText,Buff,Count,&Dx[0]);
   }else{
@@ -2794,7 +2797,7 @@
       }
     }
 
-    ExtTextOut(hdcBGBuffer,ts.FontDX,ts.FontDY,eto_options,&rect,Buff,Count,&Dx[0]);
+    ExtTextOutA(hdcBGBuffer,ts.FontDX,ts.FontDY,eto_options,&rect,Buff,Count,&Dx[0]);
     BitBlt(VTDC,*X,Y,width,height,hdcBGBuffer,0,0,SRCCOPY);
 
     SelectObject(hdcBGBuffer,hPrevFont);
@@ -3323,7 +3326,7 @@
 //  reset window
 {
   BOOL Ok;
-  LOGFONT VTlf;
+  LOGFONTA VTlf;
 
   ts.VTFlag = 1;
   if (! LoadTTDLG()) return;
@@ -3780,7 +3783,7 @@
 	GetWindowRect(HVTWin, &win);
 	GetClientRect(HVTWin, &client);
 
-	if (((mod = GetModuleHandle("user32.dll")) != NULL) &&
+	if (((mod = GetModuleHandleA("user32.dll")) != NULL) &&
 	    (GetProcAddress(mod,"MonitorFromWindow") != NULL)) {
 		// \x83}\x83\x8B\x83`\x83\x82\x83j\x83^\x82\xAA\x83T\x83|\x81[\x83g\x82\xB3\x82\xEA\x82Ă\xA2\x82\xE9\x8Fꍇ
 		monitor = MonitorFromWindow(HVTWin, MONITOR_DEFAULTTONEAREST);

Modified: branches/cmake/teraterm/teraterm/vtwin.cpp
===================================================================
--- branches/cmake/teraterm/teraterm/vtwin.cpp	2018-11-17 15:43:03 UTC (rev 7262)
+++ branches/cmake/teraterm/teraterm/vtwin.cpp	2018-11-17 15:43:21 UTC (rev 7263)
@@ -90,14 +90,32 @@
 
 #define CFrameWnd	TTCFrameWnd
 
-#define VTClassName "VTWin32"
+#define VTClassName _T("VTWin32")
 
-#if 0 //def _DEBUG
-#define new DEBUG_NEW
-#undef THIS_FILE
-static char THIS_FILE[] = __FILE__;
+#undef SetDlgItemText
+#define SetDlgItemText SetDlgItemTextA
+#undef CreateProcess
+#define CreateProcess CreateProcessA
+#undef STARTUPINFO
+#define STARTUPINFO STARTUPINFOA
+#undef GetStartupInfo
+#define GetStartupInfo GetStartupInfoA
+
+#if defined(UNICODE)
+#define CreateProcessT CreateProcessW
+#define GetStartupInfoT GetStartupInfoW
+#define STARTUPINFOT STARTUPINFOW
+#else
+#define CreateProcessT CreateProcessA
+#define GetStartupInfoT GetStartupInfoA
+#define STARTUPINFOT STARTUPINFOA
 #endif
 
+#ifdef _DEBUG
+#define malloc(l)   _malloc_dbg((l), _NORMAL_BLOCK, __FILE__, __LINE__)
+#define new  		::new(_NORMAL_BLOCK, __FILE__, __LINE__)
+#endif
+
 // \x83E\x83B\x83\x93\x83h\x83E\x8Dő剻\x83{\x83^\x83\x93\x82\xF0\x97L\x8C\xF8\x82ɂ\xB7\x82\xE9 (2005.1.15 yutaka)
 #define WINDOW_MAXMIMUM_ENABLED 1
 
@@ -330,7 +348,7 @@
 	PRegisterDeviceNotification pRegisterDeviceNotification;
 	DEV_BROADCAST_DEVICEINTERFACE filter;
 
-	if (((h = GetModuleHandle("user32.dll")) == NULL) ||
+	if (((h = GetModuleHandleA("user32.dll")) == NULL) ||
 			((pRegisterDeviceNotification = (PRegisterDeviceNotification)GetProcAddress(h, "RegisterDeviceNotificationA")) == NULL)) {
 		return;
 	}
@@ -348,7 +366,7 @@
 	HMODULE h;
 	PUnregisterDeviceNotification pUnregisterDeviceNotification;
 
-	if (((h = GetModuleHandle("user32.dll")) == NULL) ||
+	if (((h = GetModuleHandleA("user32.dll")) == NULL) ||
 			((pUnregisterDeviceNotification = (PUnregisterDeviceNotification)GetProcAddress(h, "UnregisterDeviceNotification")) == NULL)) {
 		return;
 	}
@@ -425,10 +443,10 @@
 	char imagehlp_dll[MAX_PATH];
 
 	// Windows98/Me/NT4\x82ł͓\xAE\x82\xA9\x82Ȃ\xA2\x82\xBD\x82߃X\x83L\x83b\x83v\x82\xB7\x82\xE9\x81B(2007.10.9 yutaka)
-	GetSystemDirectory(imagehlp_dll, sizeof(imagehlp_dll));
+	GetSystemDirectoryA(imagehlp_dll, sizeof(imagehlp_dll));
 	strncat_s(imagehlp_dll, sizeof(imagehlp_dll), "\\imagehlp.dll", _TRUNCATE);
-	h2 = LoadLibrary(imagehlp_dll);
-	if (((h = GetModuleHandle(imagehlp_dll)) == NULL) ||
+	h2 = LoadLibraryA(imagehlp_dll);
+	if (((h = GetModuleHandleA(imagehlp_dll)) == NULL) ||
 		(GetProcAddress(h, "SymGetLineFromAddr") == NULL)) {
 			FreeLibrary(h2);
 			goto error;
@@ -552,7 +570,7 @@
 	GlobalUnlock(pSym);
 	GlobalFree(pSym);
 
-	MessageBox(NULL, msg, "Tera Term: Application fault", MB_OK | MB_ICONEXCLAMATION);
+	MessageBoxA(NULL, msg, "Tera Term: Application fault", MB_OK | MB_ICONEXCLAMATION);
 
 error:
 //	return (EXCEPTION_EXECUTE_HANDLER);  /* \x82\xBB\x82̂܂܃v\x83\x8D\x83Z\x83X\x82\xF0\x8FI\x97\xB9\x82\xB3\x82\xB9\x82\xE9 */
@@ -736,7 +754,7 @@
 	// 256\x83o\x83C\x83g\x88ȏ\xE3\x82̃R\x83}\x83\x93\x83h\x83\x89\x83C\x83\x93\x83p\x83\x89\x83\x81\x81[\x83^\x8Ew\x92肪\x82\xA0\x82\xE9\x82ƁABOF(Buffer Over Flow)\x82\xC5
 	// \x97\x8E\x82\xBF\x82\xE9\x83o\x83O\x82\xF0\x8FC\x90\xB3\x81B(2007.6.12 maya)
 	if (LoadTTSET()) {
-		LPTSTR Param = GetCommandLine();
+		LPSTR Param = GetCommandLineA();
 		(*ParseParam)(Param, &ts, &(TopicName[0]));
 	}
 	FreeTTSET();
@@ -813,7 +831,7 @@
 		rect.right = rect.left + 100;
 		rect.bottom = rect.top + 100;
 	}
-	Create(hInst, VTClassName, "Tera Term", Style, rect, NULL, NULL);
+	Create(hInst, VTClassName, _T("Tera Term"), Style, rect, NULL, NULL);
 
 	/*--------- Init2 -----------------*/
 	HVTWin = GetSafeHwnd();
@@ -979,7 +997,6 @@
 	if ((LMR==IdLeftButton) && ControlKey() && (MainMenu==NULL) &&
 	    ((ts.MenuFlag & MF_NOPOPUP)==0)) {
 		int i, numItems;
-		char itemText[256];
 
 		InitMenu(&PopupMenu);
 
@@ -987,6 +1004,7 @@
 		numItems = GetMenuItemCount(PopupMenu);
 
 		for (i = 0; i < numItems; i++) {
+			TCHAR itemText[256];
 			HMENU submenu = GetSubMenu(PopupMenu, i);
 
 			if (submenu != NULL) {
@@ -993,7 +1011,7 @@
 				InitMenuPopup(submenu);
 			}
 
-			if (GetMenuString(PopupMenu, i, itemText, sizeof(itemText), MF_BYPOSITION) != 0) {
+			if (GetMenuString(PopupMenu, i, itemText, _countof(itemText), MF_BYPOSITION) != 0) {
 				int state = GetMenuState(PopupMenu, i, MF_BYPOSITION) &
 				            (MF_CHECKED | MF_DISABLED | MF_GRAYED | MF_HILITE |
 				             MF_MENUBARBREAK | MF_MENUBREAK | MF_SEPARATOR);
@@ -1036,7 +1054,6 @@
 		 IsClipboardFormatAvailable(CF_OEMTEXT))) {
 
 		int i, numItems;
-		char itemText[256];
 
 		InitPasteMenu(&PopupMenu);
 		PopupBase = CreatePopupMenu();
@@ -1043,7 +1060,8 @@
 		numItems = GetMenuItemCount(PopupMenu);
 
 		for (i = 0; i < numItems; i++) {
-			if (GetMenuString(PopupMenu, i, itemText, sizeof(itemText), MF_BYPOSITION) != 0) {
+			TCHAR itemText[256];
+			if (GetMenuString(PopupMenu, i, itemText, _countof(itemText), MF_BYPOSITION) != 0) {
 				int state = GetMenuState(PopupMenu, i, MF_BYPOSITION) &
 				            (MF_CHECKED | MF_DISABLED | MF_GRAYED | MF_HILITE |
 				             MF_MENUBARBREAK | MF_MENUBREAK | MF_SEPARATOR);
@@ -1121,7 +1139,7 @@
 }
 
 // LogMeIn.exe -> LogMeTT.exe \x82փ\x8A\x83l\x81[\x83\x80 (2005.2.21 yutaka)
-static char LogMeTTMenuString[] = "Log&MeTT";
+static TCHAR LogMeTTMenuString[] = _T("Log&MeTT");
 static char LogMeTT[MAX_PATH];
 
 static BOOL isLogMeTTExist()
@@ -1136,14 +1154,14 @@
 	char *path;
 
 	/* LogMeTT 2.9.6\x82\xA9\x82\xE7\x82̓\x8C\x83W\x83X\x83g\x83\x8A\x82ɃC\x83\x93\x83X\x83g\x81[\x83\x8B\x83p\x83X\x82\xAA\x8A܂܂\xEA\x82\xE9\x81B*/
-	result = RegCreateKeyEx(HKEY_CURRENT_USER, "Software\\LogMeTT", 0, NULL,
+	result = RegCreateKeyExA(HKEY_CURRENT_USER, "Software\\LogMeTT", 0, NULL,
 				REG_OPTION_NON_VOLATILE, KEY_READ, NULL, &key, &dwDisposition);
 	if (result == ERROR_SUCCESS) {
-		result = RegQueryValueEx(key, "InstallPath", NULL, &dwType, NULL, &dwSize);
+		result = RegQueryValueExA(key, "InstallPath", NULL, &dwType, NULL, &dwSize);
 		if (result == ERROR_SUCCESS) {
 			path = (char *)malloc(dwSize);
 			if (path != NULL) {
-				result = RegQueryValueEx(key, "InstallPath", NULL, &dwType, (LPBYTE)path, &dwSize);
+				result = RegQueryValueExA(key, "InstallPath", NULL, &dwType, (LPBYTE)path, &dwSize);
 				if (result == ERROR_SUCCESS) {
 					inregist = 1;
 					strncpy_s(LogMeTT, sizeof(LogMeTT), path, _TRUNCATE);
@@ -1168,18 +1186,109 @@
 
 void CVTWindow::InitMenu(HMENU *Menu)
 {
-	*Menu = LoadMenu(AfxGetInstanceHandle(),
-	                 MAKEINTRESOURCE(IDR_MENU));
-	char uimsg[MAX_UIMSG];
-	int ret;
+	static const DlgTextInfo MenuTextInfo[] = {
+		ID_FILE, "MENU_FILE",
+		ID_EDIT, "MENU_EDIT",
+		ID_SETUP, "MENU_SETUP",
+		ID_CONTROL, "MENU_CONTROL",
+		ID_HELPMENU, "MENU_HELP",
+	};
+	static const DlgTextInfo FileMenuTextInfo[] = {
+		ID_FILE_NEWCONNECTION, "MENU_FILE_NEW",
+		ID_FILE_DUPLICATESESSION, "MENU_FILE_DUPLICATE",
+		ID_FILE_CYGWINCONNECTION, "MENU_FILE_GYGWIN",
+		ID_FILE_LOG, "MENU_FILE_LOG",
+		ID_FILE_COMMENTTOLOG, "MENU_FILE_COMMENTLOG",
+		ID_FILE_VIEWLOG, "MENU_FILE_VIEWLOG",
+		ID_FILE_SHOWLOGDIALOG, "MENU_FILE_SHOWLOGDIALOG",
+		ID_FILE_SENDFILE, "MENU_FILE_SENDFILE",
+		ID_FILE_REPLAYLOG, "MENU_FILE_REPLAYLOG",
+		ID_FILE_CHANGEDIR, "MENU_FILE_CHANGEDIR",
+		ID_FILE_LOGMEIN, "MENU_FILE_LOGMETT",
+		ID_FILE_PRINT2, "MENU_FILE_PRINT",
+		ID_FILE_DISCONNECT, "MENU_FILE_DISCONNECT",
+		ID_FILE_EXIT, "MENU_FILE_EXIT",
+		ID_FILE_EXITALL, "MENU_FILE_EXITALL",
+		9, "MENU_TRANS",
+		ID_FILE_KERMITRCV, "MENU_TRANS_KERMIT_RCV",
+		ID_FILE_KERMITGET, "MENU_TRANS_KERMIT_GET",
+		ID_FILE_KERMITSEND, "MENU_TRANS_KERMIT_SEND",
+		ID_FILE_KERMITFINISH, "MENU_TRANS_KERMIT_FINISH",
+		ID_FILE_XRCV, "MENU_TRANS_X_RCV",
+		ID_FILE_XSEND, "MENU_TRANS_X_SEND",
+		ID_FILE_YRCV, "MENU_TRANS_Y_RCV",
+		ID_FILE_YSEND, "MENU_TRANS_Y_SEND",
+		ID_FILE_ZRCV, "MENU_TRANS_Z_RCV",
+		ID_FILE_ZSEND, "MENU_TRANS_Z_SEND",
+		ID_FILE_BPRCV, "MENU_TRANS_BP_RCV",
+		ID_FILE_BPSEND, "MENU_TRANS_BP_SEND",
+		ID_FILE_QVRCV, "MENU_TRANS_QV_RCV",
+		ID_FILE_QVSEND, "MENU_TRANS_QV_SEND",
+	};
+	static const DlgTextInfo EditMenuTextInfo[] = {
+		ID_EDIT_COPY2, "MENU_EDIT_COPY",
+		ID_EDIT_COPYTABLE, "MENU_EDIT_COPYTABLE",
+		ID_EDIT_PASTE2, "MENU_EDIT_PASTE",
+		ID_EDIT_PASTECR, "MENU_EDIT_PASTECR",
+		ID_EDIT_CLEARSCREEN, "MENU_EDIT_CLSCREEN",
+		ID_EDIT_CLEARBUFFER, "MENU_EDIT_CLBUFFER",
+		ID_EDIT_CANCELSELECT, "MENU_EDIT_CANCELSELECT",
+		ID_EDIT_SELECTSCREEN, "MENU_EDIT_SELECTSCREEN",
+		ID_EDIT_SELECTALL, "MENU_EDIT_SELECTALL",
+	};
+	static const DlgTextInfo SetupMenuTextInfo1[] = {
+		ID_SETUP_TERMINAL, "MENU_SETUP_TERMINAL",
+		ID_SETUP_WINDOW, "MENU_SETUP_WINDOW",
+		ID_SETUP_FONT, "MENU_SETUP_FONT",
+		ID_SETUP_KEYBOARD, "MENU_SETUP_KEYBOARD",
+		ID_SETUP_SERIALPORT, "MENU_SETUP_SERIALPORT",
+		ID_SETUP_TCPIP, "MENU_SETUP_TCPIP",
+		ID_SETUP_GENERAL, "MENU_SETUP_GENERAL",
+		ID_SETUP_ADDITIONALSETTINGS, "MENU_SETUP_ADDITION",
+		ID_SETUP_SAVE, "MENU_SETUP_SAVE",
+		ID_SETUP_RESTORE, "MENU_SETUP_RESTORE",
+		ID_OPEN_SETUP, "MENU_SETUP_OPENSETUP",
+		ID_SETUP_LOADKEYMAP, "MENU_SETUP_LOADKEYMAP",
+	};
+	static const DlgTextInfo ControlMenuTextInfo1[] = {
+		ID_CONTROL_RESETTERMINAL, "MENU_CONTROL_RESET",
+		ID_CONTROL_RESETREMOTETITLE, "MENU_CONTROL_RESETTITLE",
+		ID_CONTROL_AREYOUTHERE, "MENU_CONTROL_AREYOUTHERE",
+		ID_CONTROL_SENDBREAK, "MENU_CONTROL_SENDBREAK",
+		ID_CONTROL_RESETPORT, "MENU_CONTROL_RESETPORT",
+		ID_CONTROL_BROADCASTCOMMAND, "MENU_CONTROL_BROADCAST",
+		ID_CONTROL_OPENTEK, "MENU_CONTROL_OPENTEK",
+		ID_CONTROL_CLOSETEK, "MENU_CONTROL_CLOSETEK",
+		ID_CONTROL_MACRO, "MENU_CONTROL_MACRO",
+		ID_CONTROL_SHOW_MACRO, "MENU_CONTROL_SHOW_MACRO",
+	};
+	static const DlgTextInfo HelpMenuTextInfo[] = {
+		ID_HELP_INDEX2, "MENU_HELP_INDEX",
+		ID_HELP_ABOUT, "MENU_HELP_ABOUT",
+	};
 
-	FileMenu = GetSubMenu(*Menu,ID_FILE);
+	HMENU hMenu = LoadMenu(AfxGetInstanceHandle(),
+						   MAKEINTRESOURCE(IDR_MENU));
+	*Menu = hMenu;
+
+	FileMenu = GetSubMenu(hMenu,ID_FILE);
 	TransMenu = GetSubMenu(FileMenu,ID_TRANSFER);
-	EditMenu = GetSubMenu(*Menu,ID_EDIT);
-	SetupMenu = GetSubMenu(*Menu,ID_SETUP);
-	ControlMenu = GetSubMenu(*Menu,ID_CONTROL);
-	HelpMenu = GetSubMenu(*Menu,ID_HELPMENU);
+	EditMenu = GetSubMenu(hMenu,ID_EDIT);
+	SetupMenu = GetSubMenu(hMenu,ID_SETUP);
+	ControlMenu = GetSubMenu(hMenu,ID_CONTROL);
+	HelpMenu = GetSubMenu(hMenu,ID_HELPMENU);
+	SetDlgMenuTexts(hMenu, MenuTextInfo, _countof(MenuTextInfo), ts.UILanguageFile);
 
+	if ((ts.MenuFlag & MF_SHOWWINMENU) !=0) {
+		TCHAR uimsg[MAX_UIMSG];
+		WinMenu = CreatePopupMenu();
+		get_lang_msgT("MENU_WINDOW", uimsg, _countof(uimsg),
+					  _T("&Window"), ts.UILanguageFile);
+		::InsertMenu(*Menu, ID_HELPMENU,
+			MF_STRING | MF_ENABLED | MF_POPUP | MF_BYPOSITION,
+			(int)WinMenu, uimsg);
+	}
+
 	/* LogMeTT \x82̑\xB6\x8D݂\xF0\x8Am\x94F\x82\xB5\x82ă\x81\x83j\x83\x85\x81[\x82\xF0\x92lj\xC1\x82\xB7\x82\xE9 */
 	if (isLogMeTTExist()) {
 		::InsertMenu(FileMenu, ID_FILE_PRINT2, MF_STRING | MF_ENABLED | MF_BYCOMMAND,
@@ -1187,234 +1296,12 @@
 		::InsertMenu(FileMenu, ID_FILE_PRINT2, MF_SEPARATOR, NULL, NULL);
 	}
 
-	GetMenuString(*Menu, ID_FILE, uimsg, sizeof(uimsg), MF_BYPOSITION);
-	get_lang_msg("MENU_FILE", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
-	ModifyMenu(*Menu, ID_FILE, MF_BYPOSITION, ID_FILE, ts.UIMsg);
-	GetMenuString(FileMenu, ID_FILE_NEWCONNECTION, uimsg, sizeof(uimsg), MF_BYCOMMAND);
-	get_lang_msg("MENU_FILE_NEW", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
-	ModifyMenu(FileMenu, ID_FILE_NEWCONNECTION, MF_BYCOMMAND, ID_FILE_NEWCONNECTION, ts.UIMsg);
-	GetMenuString(FileMenu, ID_FILE_DUPLICATESESSION, uimsg, sizeof(uimsg), MF_BYCOMMAND);
-	get_lang_msg("MENU_FILE_DUPLICATE", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
-	ModifyMenu(FileMenu, ID_FILE_DUPLICATESESSION, MF_BYCOMMAND, ID_FILE_DUPLICATESESSION, ts.UIMsg);
-	GetMenuString(FileMenu, ID_FILE_CYGWINCONNECTION, uimsg, sizeof(uimsg), MF_BYCOMMAND);
-	get_lang_msg("MENU_FILE_GYGWIN", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
-	ModifyMenu(FileMenu, ID_FILE_CYGWINCONNECTION, MF_BYCOMMAND, ID_FILE_CYGWINCONNECTION, ts.UIMsg);
-	GetMenuString(FileMenu, ID_FILE_LOG, uimsg, sizeof(uimsg), MF_BYCOMMAND);
-	get_lang_msg("MENU_FILE_LOG", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
-	ModifyMenu(FileMenu, ID_FILE_LOG, MF_BYCOMMAND, ID_FILE_LOG, ts.UIMsg);
-	GetMenuString(FileMenu, ID_FILE_COMMENTTOLOG, uimsg, sizeof(uimsg), MF_BYCOMMAND);
-	get_lang_msg("MENU_FILE_COMMENTLOG", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
-	ModifyMenu(FileMenu, ID_FILE_COMMENTTOLOG, MF_BYCOMMAND, ID_FILE_COMMENTTOLOG, ts.UIMsg);
-	GetMenuString(FileMenu, ID_FILE_VIEWLOG, uimsg, sizeof(uimsg), MF_BYCOMMAND);
-	get_lang_msg("MENU_FILE_VIEWLOG", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
-	ModifyMenu(FileMenu, ID_FILE_VIEWLOG, MF_BYCOMMAND, ID_FILE_VIEWLOG, ts.UIMsg);
-	GetMenuString(FileMenu, ID_FILE_SHOWLOGDIALOG, uimsg, sizeof(uimsg), MF_BYCOMMAND);
-	get_lang_msg("MENU_FILE_SHOWLOGDIALOG", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
-	ModifyMenu(FileMenu, ID_FILE_SHOWLOGDIALOG, MF_BYCOMMAND, ID_FILE_SHOWLOGDIALOG, ts.UIMsg);
-	GetMenuString(FileMenu, ID_FILE_SENDFILE, uimsg, sizeof(uimsg), MF_BYCOMMAND);
-	get_lang_msg("MENU_FILE_SENDFILE", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
-	ModifyMenu(FileMenu, ID_FILE_SENDFILE, MF_BYCOMMAND, ID_FILE_SENDFILE, ts.UIMsg);
-	GetMenuString(FileMenu, ID_FILE_REPLAYLOG, uimsg, sizeof(uimsg), MF_BYCOMMAND);
-	get_lang_msg("MENU_FILE_REPLAYLOG", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
-	ModifyMenu(FileMenu, ID_FILE_REPLAYLOG, MF_BYCOMMAND, ID_FILE_REPLAYLOG, ts.UIMsg);
-	GetMenuString(FileMenu, ID_FILE_CHANGEDIR, uimsg, sizeof(uimsg), MF_BYCOMMAND);
-	get_lang_msg("MENU_FILE_CHANGEDIR", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
-	ModifyMenu(FileMenu, ID_FILE_CHANGEDIR, MF_BYCOMMAND, ID_FILE_CHANGEDIR, ts.UIMsg);
-	ret = GetMenuString(FileMenu, ID_FILE_LOGMEIN, uimsg, sizeof(uimsg), MF_BYCOMMAND);
-	if (ret != 0) {
-		get_lang_msg("MENU_FILE_LOGMETT", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
-		ModifyMenu(FileMenu, ID_FILE_LOGMEIN, MF_BYCOMMAND, ID_FILE_LOGMEIN, ts.UIMsg);
-	}
-	GetMenuString(FileMenu, ID_FILE_PRINT2, uimsg, sizeof(uimsg), MF_BYCOMMAND);
-	get_lang_msg("MENU_FILE_PRINT", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
-	ModifyMenu(FileMenu, ID_FILE_PRINT2, MF_BYCOMMAND, ID_FILE_PRINT2, ts.UIMsg);
-	GetMenuString(FileMenu, ID_FILE_DISCONNECT, uimsg, sizeof(uimsg), MF_BYCOMMAND);
-	get_lang_msg("MENU_FILE_DISCONNECT", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
-	ModifyMenu(FileMenu, ID_FILE_DISCONNECT, MF_BYCOMMAND, ID_FILE_DISCONNECT, ts.UIMsg);
-	GetMenuString(FileMenu, ID_FILE_EXIT, uimsg, sizeof(uimsg), MF_BYCOMMAND);
-	get_lang_msg("MENU_FILE_EXIT", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
-	ModifyMenu(FileMenu, ID_FILE_EXIT, MF_BYCOMMAND, ID_FILE_EXIT, ts.UIMsg);
-	GetMenuString(FileMenu, ID_FILE_EXITALL, uimsg, sizeof(uimsg), MF_BYCOMMAND);
-	get_lang_msg("MENU_FILE_EXITALL", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
-	ModifyMenu(FileMenu, ID_FILE_EXITALL, MF_BYCOMMAND, ID_FILE_EXITALL, ts.UIMsg);
+	SetDlgMenuTexts(FileMenu, FileMenuTextInfo, _countof(FileMenuTextInfo), ts.UILanguageFile);
+	SetDlgMenuTexts(hMenu, EditMenuTextInfo, _countof(EditMenuTextInfo), ts.UILanguageFile);
+	SetDlgMenuTexts(hMenu, SetupMenuTextInfo1, _countof(SetupMenuTextInfo1), ts.UILanguageFile);
+	SetDlgMenuTexts(hMenu, ControlMenuTextInfo1, _countof(ControlMenuTextInfo1), ts.UILanguageFile);
+	SetDlgMenuTexts(hMenu, HelpMenuTextInfo, _countof(HelpMenuTextInfo), ts.UILanguageFile);
 
-	GetMenuString(FileMenu, 9, uimsg, sizeof(uimsg), MF_BYPOSITION);
-	get_lang_msg("MENU_TRANS", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
-	ModifyMenu(FileMenu, 9, MF_BYPOSITION, 9, ts.UIMsg);
-
-	GetMenuString(FileMenu, ID_FILE_KERMITRCV, uimsg, sizeof(uimsg), MF_BYCOMMAND);
-	get_lang_msg("MENU_TRANS_KERMIT_RCV", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
-	ModifyMenu(FileMenu, ID_FILE_KERMITRCV, MF_BYCOMMAND, ID_FILE_KERMITRCV, ts.UIMsg);
-	GetMenuString(FileMenu, ID_FILE_KERMITGET, uimsg, sizeof(uimsg), MF_BYCOMMAND);
-	get_lang_msg("MENU_TRANS_KERMIT_GET", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
-	ModifyMenu(FileMenu, ID_FILE_KERMITGET, MF_BYCOMMAND, ID_FILE_KERMITGET, ts.UIMsg);
-	GetMenuString(FileMenu, ID_FILE_KERMITSEND, uimsg, sizeof(uimsg), MF_BYCOMMAND);
-	get_lang_msg("MENU_TRANS_KERMIT_SEND", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
-	ModifyMenu(FileMenu, ID_FILE_KERMITSEND, MF_BYCOMMAND, ID_FILE_KERMITSEND, ts.UIMsg);
-	GetMenuString(FileMenu, ID_FILE_KERMITFINISH, uimsg, sizeof(uimsg), MF_BYCOMMAND);
-	get_lang_msg("MENU_TRANS_KERMIT_FINISH", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
-	ModifyMenu(FileMenu, ID_FILE_KERMITFINISH, MF_BYCOMMAND, ID_FILE_KERMITFINISH, ts.UIMsg);
-
-	GetMenuString(FileMenu, ID_FILE_XRCV, uimsg, sizeof(uimsg), MF_BYCOMMAND);
-	get_lang_msg("MENU_TRANS_X_RCV", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
-	ModifyMenu(FileMenu, ID_FILE_XRCV, MF_BYCOMMAND, ID_FILE_XRCV, ts.UIMsg);
-	GetMenuString(FileMenu, ID_FILE_XSEND, uimsg, sizeof(uimsg), MF_BYCOMMAND);
-	get_lang_msg("MENU_TRANS_X_SEND", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
-	ModifyMenu(FileMenu, ID_FILE_XSEND, MF_BYCOMMAND, ID_FILE_XSEND, ts.UIMsg);
-
-	GetMenuString(FileMenu, ID_FILE_YRCV, uimsg, sizeof(uimsg), MF_BYCOMMAND);
-	get_lang_msg("MENU_TRANS_Y_RCV", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
-	ModifyMenu(FileMenu, ID_FILE_YRCV, MF_BYCOMMAND, ID_FILE_YRCV, ts.UIMsg);
-	GetMenuString(FileMenu, ID_FILE_YSEND, uimsg, sizeof(uimsg), MF_BYCOMMAND);
-	get_lang_msg("MENU_TRANS_Y_SEND", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
-	ModifyMenu(FileMenu, ID_FILE_YSEND, MF_BYCOMMAND, ID_FILE_YSEND, ts.UIMsg);
-
-	GetMenuString(FileMenu, ID_FILE_ZRCV, uimsg, sizeof(uimsg), MF_BYCOMMAND);
-	get_lang_msg("MENU_TRANS_Z_RCV", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
-	ModifyMenu(FileMenu, ID_FILE_ZRCV, MF_BYCOMMAND, ID_FILE_ZRCV, ts.UIMsg);
-	GetMenuString(FileMenu, ID_FILE_ZSEND, uimsg, sizeof(uimsg), MF_BYCOMMAND);
-	get_lang_msg("MENU_TRANS_Z_SEND", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
-	ModifyMenu(FileMenu, ID_FILE_ZSEND, MF_BYCOMMAND, ID_FILE_ZSEND, ts.UIMsg);
-
-	GetMenuString(FileMenu, ID_FILE_BPRCV, uimsg, sizeof(uimsg), MF_BYCOMMAND);
-	get_lang_msg("MENU_TRANS_BP_RCV", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
-	ModifyMenu(FileMenu, ID_FILE_BPRCV, MF_BYCOMMAND, ID_FILE_BPRCV, ts.UIMsg);
-	GetMenuString(FileMenu, ID_FILE_BPSEND, uimsg, sizeof(uimsg), MF_BYCOMMAND);
-	get_lang_msg("MENU_TRANS_BP_SEND", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
-	ModifyMenu(FileMenu, ID_FILE_BPSEND, MF_BYCOMMAND, ID_FILE_BPSEND, ts.UIMsg);
-
-	GetMenuString(FileMenu, ID_FILE_QVRCV, uimsg, sizeof(uimsg), MF_BYCOMMAND);
-	get_lang_msg("MENU_TRANS_QV_RCV", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
-	ModifyMenu(FileMenu, ID_FILE_QVRCV, MF_BYCOMMAND, ID_FILE_QVRCV, ts.UIMsg);
-	GetMenuString(FileMenu, ID_FILE_QVSEND, uimsg, sizeof(uimsg), MF_BYCOMMAND);
-	get_lang_msg("MENU_TRANS_QV_SEND", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
-	ModifyMenu(FileMenu, ID_FILE_QVSEND, MF_BYCOMMAND, ID_FILE_QVSEND, ts.UIMsg);
-
-	GetMenuString(*Menu, ID_EDIT, uimsg, sizeof(uimsg), MF_BYPOSITION);
-	get_lang_msg("MENU_EDIT", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
-	ModifyMenu(*Menu, ID_EDIT, MF_BYPOSITION, ID_EDIT, ts.UIMsg);
-	GetMenuString(EditMenu, ID_EDIT_COPY2, uimsg, sizeof(uimsg), MF_BYCOMMAND);
-	get_lang_msg("MENU_EDIT_COPY", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
-	ModifyMenu(EditMenu, ID_EDIT_COPY2, MF_BYCOMMAND, ID_EDIT_COPY2, ts.UIMsg);
-	GetMenuString(EditMenu, ID_EDIT_COPYTABLE, uimsg, sizeof(uimsg), MF_BYCOMMAND);
-	get_lang_msg("MENU_EDIT_COPYTABLE", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
-	ModifyMenu(EditMenu, ID_EDIT_COPYTABLE, MF_BYCOMMAND, ID_EDIT_COPYTABLE, ts.UIMsg);
-	GetMenuString(EditMenu, ID_EDIT_PASTE2, uimsg, sizeof(uimsg), MF_BYCOMMAND);
-	get_lang_msg("MENU_EDIT_PASTE", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
-	ModifyMenu(EditMenu, ID_EDIT_PASTE2, MF_BYCOMMAND, ID_EDIT_PASTE2, ts.UIMsg);
-	GetMenuString(EditMenu, ID_EDIT_PASTECR, uimsg, sizeof(uimsg), MF_BYCOMMAND);
-	get_lang_msg("MENU_EDIT_PASTECR", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
-	ModifyMenu(EditMenu, ID_EDIT_PASTECR, MF_BYCOMMAND, ID_EDIT_PASTECR, ts.UIMsg);
-	GetMenuString(EditMenu, ID_EDIT_CLEARSCREEN, uimsg, sizeof(uimsg), MF_BYCOMMAND);
-	get_lang_msg("MENU_EDIT_CLSCREEN", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
-	ModifyMenu(EditMenu, ID_EDIT_CLEARSCREEN, MF_BYCOMMAND, ID_EDIT_CLEARSCREEN, ts.UIMsg);
-	GetMenuString(EditMenu, ID_EDIT_CLEARBUFFER, uimsg, sizeof(uimsg), MF_BYCOMMAND);
-	get_lang_msg("MENU_EDIT_CLBUFFER", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
-	ModifyMenu(EditMenu, ID_EDIT_CLEARBUFFER, MF_BYCOMMAND, ID_EDIT_CLEARBUFFER, ts.UIMsg);
-	GetMenuString(EditMenu, ID_EDIT_CANCELSELECT, uimsg, sizeof(uimsg), MF_BYCOMMAND);
-	get_lang_msg("MENU_EDIT_CANCELSELECT", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
-	ModifyMenu(EditMenu, ID_EDIT_CANCELSELECT, MF_BYCOMMAND, ID_EDIT_CANCELSELECT, ts.UIMsg);
-	GetMenuString(EditMenu, ID_EDIT_SELECTSCREEN, uimsg, sizeof(uimsg), MF_BYCOMMAND);
-	get_lang_msg("MENU_EDIT_SELECTSCREEN", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
-	ModifyMenu(EditMenu, ID_EDIT_SELECTSCREEN, MF_BYCOMMAND, ID_EDIT_SELECTSCREEN, ts.UIMsg);
-	GetMenuString(EditMenu, ID_EDIT_SELECTALL, uimsg, sizeof(uimsg), MF_BYCOMMAND);
-	get_lang_msg("MENU_EDIT_SELECTALL", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
-	ModifyMenu(EditMenu, ID_EDIT_SELECTALL, MF_BYCOMMAND, ID_EDIT_SELECTALL, ts.UIMsg);
-
-	GetMenuString(*Menu, ID_SETUP, uimsg, sizeof(uimsg), MF_BYPOSITION);
-	get_lang_msg("MENU_SETUP", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
-	ModifyMenu(*Menu, ID_SETUP, MF_BYPOSITION, ID_SETUP, ts.UIMsg);
-	GetMenuString(SetupMenu, ID_SETUP_TERMINAL, uimsg, sizeof(uimsg), MF_BYCOMMAND);
-	get_lang_msg("MENU_SETUP_TERMINAL", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
-	ModifyMenu(SetupMenu, ID_SETUP_TERMINAL, MF_BYCOMMAND, ID_SETUP_TERMINAL, ts.UIMsg);
-	GetMenuString(SetupMenu, ID_SETUP_WINDOW, uimsg, sizeof(uimsg), MF_BYCOMMAND);
-	get_lang_msg("MENU_SETUP_WINDOW", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
-	ModifyMenu(SetupMenu, ID_SETUP_WINDOW, MF_BYCOMMAND, ID_SETUP_WINDOW, ts.UIMsg);
-	GetMenuString(SetupMenu, ID_SETUP_FONT, uimsg, sizeof(uimsg), MF_BYCOMMAND);
-	get_lang_msg("MENU_SETUP_FONT", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
-	ModifyMenu(SetupMenu, ID_SETUP_FONT, MF_BYCOMMAND, ID_SETUP_FONT, ts.UIMsg);
-	GetMenuString(SetupMenu, ID_SETUP_KEYBOARD, uimsg, sizeof(uimsg), MF_BYCOMMAND);
-	get_lang_msg("MENU_SETUP_KEYBOARD", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
-	ModifyMenu(SetupMenu, ID_SETUP_KEYBOARD, MF_BYCOMMAND, ID_SETUP_KEYBOARD, ts.UIMsg);
-	GetMenuString(SetupMenu, ID_SETUP_SERIALPORT, uimsg, sizeof(uimsg), MF_BYCOMMAND);
-	get_lang_msg("MENU_SETUP_SERIALPORT", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
-	ModifyMenu(SetupMenu, ID_SETUP_SERIALPORT, MF_BYCOMMAND, ID_SETUP_SERIALPORT, ts.UIMsg);
-	GetMenuString(SetupMenu, ID_SETUP_TCPIP, uimsg, sizeof(uimsg), MF_BYCOMMAND);
-	get_lang_msg("MENU_SETUP_TCPIP", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
-	ModifyMenu(SetupMenu, ID_SETUP_TCPIP, MF_BYCOMMAND, ID_SETUP_TCPIP, ts.UIMsg);
-	GetMenuString(SetupMenu, ID_SETUP_GENERAL, uimsg, sizeof(uimsg), MF_BYCOMMAND);
-	get_lang_msg("MENU_SETUP_GENERAL", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
-	ModifyMenu(SetupMenu, ID_SETUP_GENERAL, MF_BYCOMMAND, ID_SETUP_GENERAL, ts.UIMsg);
-	GetMenuString(SetupMenu, ID_SETUP_ADDITIONALSETTINGS, uimsg, sizeof(uimsg), MF_BYCOMMAND);
-	get_lang_msg("MENU_SETUP_ADDITION", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
-	ModifyMenu(SetupMenu, ID_SETUP_ADDITIONALSETTINGS, MF_BYCOMMAND, ID_SETUP_ADDITIONALSETTINGS, ts.UIMsg);
-	GetMenuString(SetupMenu, ID_SETUP_SAVE, uimsg, sizeof(uimsg), MF_BYCOMMAND);
-	get_lang_msg("MENU_SETUP_SAVE", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
-	ModifyMenu(SetupMenu, ID_SETUP_SAVE, MF_BYCOMMAND, ID_SETUP_SAVE, ts.UIMsg);
-	GetMenuString(SetupMenu, ID_SETUP_RESTORE, uimsg, sizeof(uimsg), MF_BYCOMMAND);
-	get_lang_msg("MENU_SETUP_RESTORE", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
-	ModifyMenu(SetupMenu, ID_SETUP_RESTORE, MF_BYCOMMAND, ID_SETUP_RESTORE, ts.UIMsg);
-	GetMenuString(SetupMenu, ID_OPEN_SETUP, uimsg, sizeof(uimsg), MF_BYCOMMAND);
-	get_lang_msg("MENU_SETUP_OPENSETUP", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
-	ModifyMenu(SetupMenu, ID_OPEN_SETUP, MF_BYCOMMAND, ID_OPEN_SETUP, ts.UIMsg);
-	GetMenuString(SetupMenu, ID_SETUP_LOADKEYMAP, uimsg, sizeof(uimsg), MF_BYCOMMAND);
-	get_lang_msg("MENU_SETUP_LOADKEYMAP", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
-	ModifyMenu(SetupMenu, ID_SETUP_LOADKEYMAP, MF_BYCOMMAND, ID_SETUP_LOADKEYMAP, ts.UIMsg);
-
-	GetMenuString(*Menu, ID_CONTROL, uimsg, sizeof(uimsg), MF_BYPOSITION);
-	get_lang_msg("MENU_CONTROL", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
-	ModifyMenu(*Menu, ID_CONTROL, MF_BYPOSITION, ID_CONTROL, ts.UIMsg);
-	GetMenuString(ControlMenu, ID_CONTROL_RESETTERMINAL, uimsg, sizeof(uimsg), MF_BYCOMMAND);
-	get_lang_msg("MENU_CONTROL_RESET", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
-	ModifyMenu(ControlMenu, ID_CONTROL_RESETTERMINAL, MF_BYCOMMAND, ID_CONTROL_RESETTERMINAL, ts.UIMsg);
-	GetMenuString(ControlMenu, ID_CONTROL_RESETREMOTETITLE, uimsg, sizeof(uimsg), MF_BYCOMMAND);
-	get_lang_msg("MENU_CONTROL_RESETTITLE", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
-	ModifyMenu(ControlMenu, ID_CONTROL_RESETREMOTETITLE, MF_BYCOMMAND, ID_CONTROL_RESETREMOTETITLE, ts.UIMsg);
-	GetMenuString(ControlMenu, ID_CONTROL_AREYOUTHERE, uimsg, sizeof(uimsg), MF_BYCOMMAND);
-	get_lang_msg("MENU_CONTROL_AREYOUTHERE", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
-	ModifyMenu(ControlMenu, ID_CONTROL_AREYOUTHERE, MF_BYCOMMAND, ID_CONTROL_AREYOUTHERE, ts.UIMsg);
-	GetMenuString(ControlMenu, ID_CONTROL_SENDBREAK, uimsg, sizeof(uimsg), MF_BYCOMMAND);
-	get_lang_msg("MENU_CONTROL_SENDBREAK", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
-	ModifyMenu(ControlMenu, ID_CONTROL_SENDBREAK, MF_BYCOMMAND, ID_CONTROL_SENDBREAK, ts.UIMsg);
-	GetMenuString(ControlMenu, ID_CONTROL_RESETPORT, uimsg, sizeof(uimsg), MF_BYCOMMAND);
-	get_lang_msg("MENU_CONTROL_RESETPORT", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
-	ModifyMenu(ControlMenu, ID_CONTROL_RESETPORT, MF_BYCOMMAND, ID_CONTROL_RESETPORT, ts.UIMsg);
-	GetMenuString(ControlMenu, ID_CONTROL_BROADCASTCOMMAND, uimsg, sizeof(uimsg), MF_BYCOMMAND);
-	get_lang_msg("MENU_CONTROL_BROADCAST", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
-	ModifyMenu(ControlMenu, ID_CONTROL_BROADCASTCOMMAND, MF_BYCOMMAND, ID_CONTROL_BROADCASTCOMMAND, ts.UIMsg);
-	GetMenuString(ControlMenu, ID_CONTROL_OPENTEK, uimsg, sizeof(uimsg), MF_BYCOMMAND);
-	get_lang_msg("MENU_CONTROL_OPENTEK", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
-	ModifyMenu(ControlMenu, ID_CONTROL_OPENTEK, MF_BYCOMMAND, ID_CONTROL_OPENTEK, ts.UIMsg);
-	GetMenuString(ControlMenu, ID_CONTROL_CLOSETEK, uimsg, sizeof(uimsg), MF_BYCOMMAND);
-	get_lang_msg("MENU_CONTROL_CLOSETEK", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
-	ModifyMenu(ControlMenu, ID_CONTROL_CLOSETEK, MF_BYCOMMAND, ID_CONTROL_CLOSETEK, ts.UIMsg);
-
-	GetMenuString(ControlMenu, ID_CONTROL_MACRO, uimsg, sizeof(uimsg), MF_BYCOMMAND);
-	get_lang_msg("MENU_CONTROL_MACRO", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
-	ModifyMenu(ControlMenu, ID_CONTROL_MACRO, MF_BYCOMMAND, ID_CONTROL_MACRO, ts.UIMsg);
-	GetMenuString(ControlMenu, ID_CONTROL_SHOW_MACRO, uimsg, sizeof(uimsg), MF_BYCOMMAND);
-	get_lang_msg("MENU_CONTROL_SHOW_MACRO", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
-	ModifyMenu(ControlMenu, ID_CONTROL_SHOW_MACRO, MF_BYCOMMAND, ID_CONTROL_SHOW_MACRO, ts.UIMsg);
-
-	GetMenuString(*Menu, ID_HELPMENU, uimsg, sizeof(uimsg), MF_BYPOSITION);
-	get_lang_msg("MENU_HELP", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
-	ModifyMenu(*Menu, ID_HELPMENU, MF_BYPOSITION, ID_HELPMENU, ts.UIMsg);
-	GetMenuString(HelpMenu, ID_HELP_INDEX2, uimsg, sizeof(uimsg), MF_BYCOMMAND);
-	get_lang_msg("MENU_HELP_INDEX", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
-	ModifyMenu(HelpMenu, ID_HELP_INDEX2, MF_BYCOMMAND, ID_HELP_INDEX2, ts.UIMsg);
-	GetMenuString(HelpMenu, ID_HELP_ABOUT, uimsg, sizeof(uimsg), MF_BYCOMMAND);
-	get_lang_msg("MENU_HELP_ABOUT", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
-	ModifyMenu(HelpMenu, ID_HELP_ABOUT, MF_BYCOMMAND, ID_HELP_ABOUT, ts.UIMsg);
-
-	if ((ts.MenuFlag & MF_SHOWWINMENU) !=0) {
-		WinMenu = CreatePopupMenu();
-		get_lang_msg("MENU_WINDOW", ts.UIMsg, sizeof(ts.UIMsg),
-		             "&Window", ts.UILanguageFile);
-		::InsertMenu(*Menu,ID_HELPMENU,
-		             MF_STRING | MF_ENABLED | MF_POPUP | MF_BYPOSITION,
-		             (int)WinMenu, ts.UIMsg);
-	}
-
 	TTXModifyMenu(*Menu); /* TTPLUG */
 }
 
@@ -1590,17 +1477,13 @@
 // added ConfirmPasteMouseRButton (2007.3.17 maya)
 void CVTWindow::InitPasteMenu(HMENU *Menu)
 {
-	char uimsg[MAX_UIMSG];
-
+	static const DlgTextInfo MenuTextInfo[] = {
+		ID_EDIT_PASTE2, "MENU_EDIT_PASTE",
+		ID_EDIT_PASTECR, "MENU_EDIT_PASTECR",
+	};
 	*Menu = LoadMenu(AfxGetInstanceHandle(),
 	                 MAKEINTRESOURCE(IDR_PASTEMENU));
-
-	GetMenuString(*Menu, ID_EDIT_PASTE2, uimsg, sizeof(uimsg), MF_BYCOMMAND);
-	get_lang_msg("MENU_EDIT_PASTE", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
-	ModifyMenu(*Menu, ID_EDIT_PASTE2, MF_BYCOMMAND, ID_EDIT_PASTE2, ts.UIMsg);
-	GetMenuString(*Menu, ID_EDIT_PASTECR, uimsg, sizeof(uimsg), MF_BYCOMMAND);
-	get_lang_msg("MENU_EDIT_PASTECR", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
-	ModifyMenu(*Menu, ID_EDIT_PASTECR, MF_BYCOMMAND, ID_EDIT_PASTECR, ts.UIMsg);
+	SetDlgMenuTexts(*Menu, MenuTextInfo, _countof(MenuTextInfo), ts.UILanguageFile);
 }
 
 void CVTWindow::ResetSetup()
@@ -1909,7 +1792,7 @@
 {
 	char Temp[32];
 	_snprintf_s(Temp, sizeof(Temp), _TRUNCATE, "%d,%d", i1, i2);
-	WritePrivateProfileString(Sect, Key, Temp, FName);
+	WritePrivateProfileStringA(Sect, Key, Temp, FName);
 }
 
 static void SaveVTPos()
@@ -1931,12 +1814,13 @@
 		MessageBeep(0);
 		return;
 	}
-	get_lang_msg("MSG_DISCONNECT_CONF", ts.UIMsg, sizeof(ts.UIMsg),
-	             "Disconnect?", ts.UILanguageFile);
+	TCHAR uimsg[MAX_UIMSG];
+	get_lang_msgT("MSG_DISCONNECT_CONF", uimsg, _countof(uimsg),
+				  _T("Disconnect?"), ts.UILanguageFile);
 	if (cv.Ready && (cv.PortType==IdTCPIP) &&
 	    ((ts.PortFlag & PF_CONFIRMDISCONN) != 0) &&
 	    ! CloseTT &&
-	    (::MessageBox(HVTWin, ts.UIMsg, "Tera Term",
+	    (::MessageBox(HVTWin, uimsg, _T("Tera Term"),
 	     MB_OKCANCEL | MB_ICONEXCLAMATION | MB_DEFBUTTON2)==IDCANCEL)) {
 		return;
 	}
@@ -1953,9 +1837,10 @@
 {
 	// \x93ˑR\x8FI\x97\xB9\x82\xB3\x82\xB9\x82\xE9\x82Ɗ댯\x82Ȃ̂ŁA\x82\xA9\x82Ȃ炸\x83\x86\x81[\x83U\x82ɖ₢\x8D\x87\x82킹\x82\xF0\x8Fo\x82\xB7\x82悤\x82ɂ\xB7\x82\xE9\x81B
 	// (2013.8.17 yutaka)
-	get_lang_msg("MSG_ALL_TERMINATE_CONF", ts.UIMsg, sizeof(ts.UIMsg),
-	             "Terminate ALL Tera Term(s)?", ts.UILanguageFile);
-	if (::MessageBox(HVTWin, ts.UIMsg, "Tera Term",
+	TCHAR uimsg[MAX_UIMSG];
+	get_lang_msgT("MSG_ALL_TERMINATE_CONF", uimsg, _countof(uimsg),
+	             _T("Terminate ALL Tera Term(s)?"), ts.UILanguageFile);
+	if (::MessageBox(HVTWin, uimsg, _T("Tera Term"),
 	     MB_OKCANCEL | MB_ICONERROR | MB_DEFBUTTON2)==IDCANCEL)
 		return;
 
@@ -2047,14 +1932,21 @@
 	*d = '\0'; // null-terminate
 }
 
-static void PasteString(PComVar cv, const char *str, bool escape)
+static void PasteString(PComVar cv, const TCHAR *str, bool escape)
 {
-	PCHAR ptr = (PCHAR)str;
+#if defined(UNICODE)
+	char fileName[MAX_PATH];
+	WideCharToMultiByte(CP_ACP, 0, str, -1, fileName, sizeof(fileName), NULL, NULL);
+	const char *strA = fileName;
+#else
+	const char *strA = str;
+#endif
+	PCHAR ptr = (PCHAR)strA;
 	char *tmpbuf = NULL;
 	if (escape) {
-		size_t len = strlen(str) * 2;
+		size_t len = strlen(strA) * 2;
 		tmpbuf = (char *)malloc(len);
-		EscapeFilename(str, tmpbuf);
+		EscapeFilename(strA, tmpbuf);
 		ptr = tmpbuf;
 	}
 
@@ -2071,7 +1963,7 @@
 }
 
 /* \x93\xFC\x97͂̓t\x83@\x83C\x83\x8B\x82̂\xDD(\x83t\x83H\x83\x8B\x83_\x82͊܂܂\xEA\x82Ȃ\xA2) */
-static bool SendScp(char *Filenames[], int FileCount, const char *SendDir)
+static bool SendScp(TCHAR *Filenames[], int FileCount, const char *SendDir)
 {
 	typedef int (CALLBACK *PSSH_start_scp)(char *, char *);
 	static PSSH_start_scp func = NULL;
@@ -2079,11 +1971,11 @@
 	char msg[128];
 
 	if (h == NULL) {
-		h = GetModuleHandle("ttxssh.dll");
+		h = GetModuleHandleA("ttxssh.dll");
 		if (h == NULL) {
 			_snprintf_s(msg, sizeof(msg), _TRUNCATE, "GetModuleHandle(\"ttxssh.dll\")) %d", GetLastError());
 		scp_send_error:
-			::MessageBox(NULL, msg, "Tera Term: scpsend command error", MB_OK | MB_ICONERROR);
+			::MessageBoxA(NULL, msg, "Tera Term: scpsend command error", MB_OK | MB_ICONERROR);
 			return false;
 		}
 	}
@@ -2096,7 +1988,12 @@
 	}
 
 	for (int i = 0; i < FileCount; i++) {
+#if defined(UNICODE)
+		char FileName[MAX_PATH];
+		WideCharToMultiByte(CP_ACP, 0, Filenames[i], -1, FileName, sizeof(FileName), NULL, NULL);
+#else
 		const char *FileName = Filenames[i];
+#endif
 		func((char *)FileName, ts.ScpSendDir);
 	}
 	return true;
@@ -2126,7 +2023,7 @@
 	int FileCount = 0;
 	int DirectoryCount = 0;
 	for (int i = 0; i < DropListCount; i++) {
-		const char *FileName = DropLists[i];
+		const TCHAR *FileName = DropLists[i];
 		const DWORD attr = GetFileAttributes(FileName);
 		if (attr == (DWORD)-1 ) {
 			FileCount++;
@@ -2205,7 +2102,7 @@
 	}
 
 	for (int i = 0; i < DropListCount; i++) {
-		const char *FileName = DropLists[i];
+		const TCHAR *FileName = DropLists[i];
 
 		if (!DoSameProcess) {
 			bool DoSameProcessNextDrop;
@@ -2242,7 +2139,11 @@
 		case DROP_TYPE_SEND_FILE_BINARY:
 			if (SendVar==NULL && NewFileVar(&SendVar)) {
 				HelpId = HlpFileSend;
+#if defined(UNICODE)
+				WideCharToMultiByte(CP_ACP, 0, FileName, -1, SendVar->FullName, sizeof(SendVar->FullName), NULL, NULL);
+#else
 				strncpy_s(SendVar->FullName, sizeof(SendVar->FullName), FileName,  _TRUNCATE);
+#endif
 				SendVar->DirLen = 0;
 				ts.TransBin = DropType == DROP_TYPE_SEND_FILE ? 0 : 1;
 				FileSendStart();
@@ -2272,7 +2173,7 @@
 
 			PasteString(&cv, FileName, escape);
 			if (DropListCount > 1 && i < DropListCount - 1) {
-				const char *separator = (DropTypePaste & DROP_TYPE_PASTE_NEWLINE) ? "\n" : " ";
+				const TCHAR *separator = (DropTypePaste & DROP_TYPE_PASTE_NEWLINE) ? _T("\n") : _T(" ");
 				PasteString(&cv, separator, false);
 			}
 
@@ -2283,7 +2184,7 @@
 		case DROP_TYPE_SCP:
 		{
 			// send by scp
-			char **FileNames = &DropLists[i];
+			TCHAR **FileNames = &DropLists[i];
 			int FileCountScp = DoSameProcess ? DropListCount - i : 1;
 			if (!SendScp(FileNames, FileCountScp, ts.ScpSendDir)) {
 				goto finish;
@@ -2307,11 +2208,11 @@
 		const UINT ShowDialog =
 			((GetAsyncKeyState(VK_CONTROL) & 0x8000) != 0) ? 1 : 0;
 		DropListCount = DragQueryFile(hDropInfo, -1, NULL, 0);
-		DropLists = (char **)malloc(sizeof(char *) * DropListCount);
+		DropLists = (TCHAR **)malloc(sizeof(TCHAR *) * DropListCount);
 
 		for (int i = 0; i < DropListCount; i++) {
 			const UINT cch = DragQueryFile(hDropInfo, i, NULL, 0) + 1;
-			char *FileName = (char *)malloc(cch);
+			TCHAR *FileName = (TCHAR *)malloc(cch*sizeof(TCHAR));
 			DropLists[i] = FileName;
 			DragQueryFile(hDropInfo,i,FileName,cch);
 		}
@@ -2391,6 +2292,7 @@
 
 	if (MetaKey(ts.MetaKey) && (nFlags & 0x2000) != 0)
 	{
+
 		PeekMessage((LPMSG)&M,HVTWin,WM_CHAR,WM_CHAR,PM_REMOVE);
 		/* for Ctrl+Alt+Key combination */
 		GetKeyboardState((PBYTE)KeyState);
@@ -3467,12 +3369,13 @@
 	if ((MainMenu!=NULL) &&
 	    (B1 != B2)) {
 		if (WinMenu==NULL) {
+			TCHAR uimsg[MAX_UIMSG];
 			WinMenu = CreatePopupMenu();
-			get_lang_msg("MENU_WINDOW", ts.UIMsg, sizeof(ts.UIMsg),
-			             "&Window", ts.UILanguageFile);
-			::InsertMenu(MainMenu,ID_HELPMENU,
-			             MF_STRING | MF_ENABLED | MF_POPUP | MF_BYPOSITION,
-			             (int)WinMenu, ts.UIMsg);
+			get_lang_msgT("MENU_WINDOW", uimsg, _countof(uimsg),
+						  _T("&Window"), ts.UILanguageFile);
+			::InsertMenu(MainMenu, ID_HELPMENU,
+						 MF_STRING | MF_ENABLED | MF_POPUP | MF_BYPOSITION,
+						 (int)WinMenu, uimsg);
 		}
 		else {
 			RemoveMenu(MainMenu,ID_HELPMENU,MF_BYPOSITION);
@@ -3484,11 +3387,12 @@
 
 	::GetSystemMenu(HVTWin,TRUE);
 	if ((! Show) && ((ts.MenuFlag & MF_NOSHOWMENU)==0)) {
+		TCHAR uimsg[MAX_UIMSG];
 		SysMenu = ::GetSystemMenu(HVTWin,FALSE);
 		AppendMenu(SysMenu, MF_SEPARATOR, 0, NULL);
-		get_lang_msg("MENU_SHOW_MENUBAR", ts.UIMsg, sizeof(ts.UIMsg),
-		             "Show menu &bar", ts.UILanguageFile);
-		AppendMenu(SysMenu, MF_STRING, ID_SHOWMENUBAR, ts.UIMsg);
+		get_lang_msgT("MENU_SHOW_MENUBAR", uimsg, _countof(uimsg),
+		             _T("Show menu &bar"), ts.UILanguageFile);
+		AppendMenu(SysMenu, MF_STRING, ID_SHOWMENUBAR, uimsg);
 	}
 	return 0;
 }
@@ -3546,11 +3450,12 @@
 
 	if ((ts.HideTitle==0) && (MainMenu==NULL) &&
 	    ((ts.MenuFlag & MF_NOSHOWMENU) == 0)) {
+		TCHAR uimsg[MAX_UIMSG];
 		SysMenu = ::GetSystemMenu(HVTWin,FALSE);
 		AppendMenu(SysMenu, MF_SEPARATOR, 0, NULL);
-		get_lang_msg("MENU_SHOW_MENUBAR", ts.UIMsg, sizeof(ts.UIMsg),
-		             "Show menu &bar", ts.UILanguageFile);
-		AppendMenu(SysMenu, MF_STRING, ID_SHOWMENUBAR, ts.UIMsg);
+		get_lang_msgT("MENU_SHOW_MENUBAR", uimsg, _countof(uimsg),
+					  _T("Show menu &bar"), ts.UILanguageFile);
+		AppendMenu(SysMenu, MF_STRING, ID_SHOWMENUBAR, uimsg);
 	}
 	return 0;
 }
@@ -3975,12 +3880,13 @@
 
 	if (CreateProcess(NULL, Command, NULL, NULL, FALSE, 0,
 	                  NULL, NULL, &si, &pi) == 0) {
-		char buf[80];
-		char uimsg[MAX_UIMSG];
-		get_lang_msg("MSG_ERROR", uimsg, sizeof(uimsg), "ERROR", ts.UILanguageFile);
-		get_lang_msg("MSG_EXEC_TT_ERROR", ts.UIMsg, sizeof(ts.UIMsg),
-		             "Can't execute Tera Term. (%d)", ts.UILanguageFile);
-		_snprintf_s(buf, sizeof(buf), _TRUNCATE, ts.UIMsg, GetLastError());
+		TCHAR buf[80];
+		TCHAR uimsg[MAX_UIMSG];
+		TCHAR uimsg2[80];
+		get_lang_msgT("MSG_ERROR", uimsg, _countof(uimsg), _T("ERROR"), ts.UILanguageFile);
+		get_lang_msgT("MSG_EXEC_TT_ERROR", uimsg2, _countof(uimsg2),
+					  _T("Can't execute Tera Term. (%d)"), ts.UILanguageFile);
+		_sntprintf_s(buf, _countof(buf), _TRUNCATE, uimsg2, GetLastError());
 		::MessageBox(NULL, buf, uimsg, MB_OK | MB_ICONWARNING);
 	}
 }
@@ -3998,15 +3904,16 @@
 	char cygterm[MAX_PATH];
 	STARTUPINFO si;
 	PROCESS_INFORMATION pi;
-	char uimsg[MAX_UIMSG];
+	TCHAR uimsg[MAX_UIMSG];
+	TCHAR uimsg2[MAX_UIMSG];
 
 	if (strlen(ts.CygwinDirectory) > 0) {
-		if (SearchPath(ts.CygwinDirectory, "bin\\cygwin1", ".dll", sizeof(file), file, &filename) > 0) {
+		if (SearchPathA(ts.CygwinDirectory, "bin\\cygwin1", ".dll", sizeof(file), file, &filename) > 0) {
 			goto found_dll;
 		}
 	}
 
-	if (SearchPath(NULL, "cygwin1", ".dll", sizeof(file), file, &filename) > 0) {
+	if (SearchPathA(NULL, "cygwin1", ".dll", sizeof(file), file, &filename) > 0) {
 		goto found_path;
 	}
 
@@ -4013,15 +3920,15 @@
 	for (c = 'C' ; c <= 'Z' ; c++) {
 		char tmp[MAX_PATH];
 		sprintf(tmp, "%c:\\cygwin\\bin;%c:\\cygwin64\\bin", c, c);
-		if (SearchPath(tmp, "cygwin1", ".dll", sizeof(file), file, &filename) > 0) {
+		if (SearchPathA(tmp, "cygwin1", ".dll", sizeof(file), file, &filename) > 0) {
 			goto found_dll;
 		}
 	}
 
-	get_lang_msg("MSG_ERROR", uimsg, sizeof(uimsg), "ERROR", ts.UILanguageFile);
-	get_lang_msg("MSG_FIND_CYGTERM_DIR_ERROR", ts.UIMsg, sizeof(ts.UIMsg),
-	             "Can't find Cygwin directory.", ts.UILanguageFile);
-	::MessageBox(NULL, ts.UIMsg, uimsg, MB_OK | MB_ICONWARNING);
+	get_lang_msgT("MSG_ERROR", uimsg, _countof(uimsg), _T("ERROR"), ts.UILanguageFile);
+	get_lang_msgT("MSG_FIND_CYGTERM_DIR_ERROR", uimsg2, _countof(uimsg2),
+				  _T("Can't find Cygwin directory."), ts.UILanguageFile);
+	::MessageBox(NULL, uimsg2, uimsg, MB_OK | MB_ICONWARNING);
 	return;
 
 found_dll:;
@@ -4030,10 +3937,10 @@
 	if (envptr != NULL) {
 		envbufflen = strlen(file) + strlen(envptr) + 7; // "PATH="(5) + ";"(1) + NUL(1)
 		if ((envbuff = (char *)malloc(envbufflen)) == NULL) {
-			get_lang_msg("MSG_ERROR", uimsg, sizeof(uimsg), "ERROR", ts.UILanguageFile);
-			get_lang_msg("MSG_CYGTERM_ENV_ALLOC_ERROR", ts.UIMsg, sizeof(ts.UIMsg),
-			             "Can't allocate memory for environment variable.", ts.UILanguageFile);
-			::MessageBox(NULL, ts.UIMsg, uimsg, MB_OK | MB_ICONWARNING);
+			get_lang_msgT("MSG_ERROR", uimsg, _countof(uimsg), _T("ERROR"), ts.UILanguageFile);
+			get_lang_msgT("MSG_CYGTERM_ENV_ALLOC_ERROR", uimsg2, _countof(uimsg2),
+			             _T("Can't allocate memory for environment variable."), ts.UILanguageFile);
+			::MessageBox(NULL, uimsg2, uimsg, MB_OK | MB_ICONWARNING);
 			return;
 		}
 		_snprintf_s(envbuff, envbufflen, _TRUNCATE, "PATH=%s;%s", file, envptr);
@@ -4040,10 +3947,10 @@
 	} else {
 		envbufflen = strlen(file) + 6; // "PATH="(5) + NUL(1)
 		if ((envbuff = (char *)malloc(envbufflen)) == NULL) {
-			get_lang_msg("MSG_ERROR", uimsg, sizeof(uimsg), "ERROR", ts.UILanguageFile);
-			get_lang_msg("MSG_CYGTERM_ENV_ALLOC_ERROR", ts.UIMsg, sizeof(ts.UIMsg),
-			             "Can't allocate memory for environment variable.", ts.UILanguageFile);
-			::MessageBox(NULL, ts.UIMsg, uimsg, MB_OK | MB_ICONWARNING);
+			get_lang_msgT("MSG_ERROR", uimsg, _countof(uimsg), _T("ERROR"), ts.UILanguageFile);
+			get_lang_msgT("MSG_CYGTERM_ENV_ALLOC_ERROR", uimsg2, _countof(uimsg2),
+			             _T("Can't allocate memory for environment variable."), ts.UILanguageFile);
+			::MessageBox(NULL, uimsg2, uimsg, MB_OK | MB_ICONWARNING);
 			return;
 		}
 		_snprintf_s(envbuff, envbufflen, _TRUNCATE, "PATH=%s", file);
@@ -4065,10 +3972,10 @@
 
 	if (CreateProcess(NULL, cygterm, NULL, NULL, FALSE, 0,
 	                  NULL, NULL, &si, &pi) == 0) {
-		get_lang_msg("MSG_ERROR", uimsg, sizeof(uimsg), "ERROR", ts.UILanguageFile);
-		get_lang_msg("MSG_EXEC_CYGTERM_ERROR", ts.UIMsg, sizeof(ts.UIMsg),
-		             "Can't execute Cygterm.", ts.UILanguageFile);
-		::MessageBox(NULL, ts.UIMsg, uimsg, MB_OK | MB_ICONWARNING);
+		get_lang_msgT("MSG_ERROR", uimsg, _countof(uimsg), _T("ERROR"), ts.UILanguageFile);
+		get_lang_msgT("MSG_EXEC_CYGTERM_ERROR", uimsg2, _countof(uimsg2),
+					  _T("Can't execute Cygterm."), ts.UILanguageFile);
+		::MessageBox(NULL, uimsg2, uimsg, MB_OK | MB_ICONWARNING);
 	}
 }
 
@@ -4088,12 +3995,13 @@
 
 	if (CreateProcess(NULL, (LPSTR)exename, NULL, NULL, FALSE, 0,
 	                  NULL, NULL, &si, &pi) == 0) {
-		char buf[80];
-		char uimsg[MAX_UIMSG];
-		get_lang_msg("MSG_ERROR", uimsg, sizeof(uimsg), "ERROR", ts.UILanguageFile);
-		get_lang_msg("MSG_EXEC_TTMENU_ERROR", ts.UIMsg, sizeof(ts.UIMsg),
-		             "Can't execute TeraTerm Menu. (%d)", ts.UILanguageFile);
-		_snprintf_s(buf, sizeof(buf), _TRUNCATE, ts.UIMsg, GetLastError());
+		TCHAR buf[80];
+		TCHAR uimsg[MAX_UIMSG];
+		TCHAR uimsg2[80];
+		get_lang_msgT("MSG_ERROR", uimsg, _countof(uimsg), _T("ERROR"), ts.UILanguageFile);
+		get_lang_msgT("MSG_EXEC_TTMENU_ERROR", uimsg2, _countof(uimsg2),
+					  _T("Can't execute TeraTerm Menu. (%d)"), ts.UILanguageFile);
+		_sntprintf_s(buf, _countof(buf), _TRUNCATE, uimsg2, GetLastError());
 		::MessageBox(NULL, buf, uimsg, MB_OK | MB_ICONWARNING);
 	}
 }
@@ -4117,12 +4025,13 @@
 
 	if (CreateProcess(NULL, LogMeTT, NULL, NULL, FALSE, 0,
 	                  NULL, NULL, &si, &pi) == 0) {
-		char buf[80];
-		char uimsg[MAX_UIMSG];
-		get_lang_msg("MSG_ERROR", uimsg, sizeof(uimsg), "ERROR", ts.UILanguageFile);
-		get_lang_msg("MSG_EXEC_LOGMETT_ERROR", ts.UIMsg, sizeof(ts.UIMsg),
-		             "Can't execute LogMeTT. (%d)", ts.UILanguageFile);
-		_snprintf_s(buf, sizeof(buf), _TRUNCATE, ts.UIMsg, GetLastError());
+		TCHAR buf[80];
+		TCHAR uimsg[MAX_UIMSG];
+		TCHAR uimsg2[80];
+		get_lang_msgT("MSG_ERROR", uimsg, _countof(uimsg), _T("ERROR"), ts.UILanguageFile);
+		get_lang_msgT("MSG_EXEC_LOGMETT_ERROR", uimsg2, _countof(uimsg2),
+					  _T("Can't execute LogMeTT. (%d)"), ts.UILanguageFile);
+		_sntprintf_s(buf, _countof(buf), _TRUNCATE, uimsg2, GetLastError());
 		::MessageBox(NULL, buf, uimsg, MB_OK | MB_ICONWARNING);
 	}
 }
@@ -4155,7 +4064,7 @@
 			switch (LOWORD(wp)) {
 				case IDOK:
 					memset(buf, 0, sizeof(buf));
-					ret = GetDlgItemText(hDlgWnd, IDC_EDIT_COMMENT, buf, sizeof(buf) - 1);
+					ret = GetDlgItemTextA(hDlgWnd, IDC_EDIT_COMMENT, buf, sizeof(buf) - 1);
 					if (ret > 0) { // \x83e\x83L\x83X\x83g\x8E擾\x90\xAC\x8C\xF7
 						//buf[sizeof(buf) - 1] = '\0';  // null-terminate
 						CommentLogToFile(buf, ret);
@@ -4204,12 +4113,13 @@
 
 	if (CreateProcess(NULL, command, NULL, NULL, FALSE, 0,
 	                  NULL, NULL, &si, &pi) == 0) {
-		char buf[80];
-		char uimsg[MAX_UIMSG];
-		get_lang_msg("MSG_ERROR", uimsg, sizeof(uimsg), "ERROR", ts.UILanguageFile);
-		get_lang_msg("MSG_VIEW_LOGFILE_ERROR", ts.UIMsg, sizeof(ts.UIMsg),
-		             "Can't view logging file. (%d)", ts.UILanguageFile);
-		_snprintf_s(buf, sizeof(buf), _TRUNCATE, ts.UIMsg, GetLastError());
+		TCHAR buf[80];
+		TCHAR uimsg[MAX_UIMSG];
+		TCHAR uimsg2[MAX_UIMSG];
+		get_lang_msgT("MSG_ERROR", uimsg, _countof(uimsg), _T("ERROR"), ts.UILanguageFile);
+		get_lang_msgT("MSG_VIEW_LOGFILE_ERROR", uimsg2, _countof(uimsg2),
+					  _T("Can't view logging file. (%d)"), ts.UILanguageFile);
+		_sntprintf_s(buf, _countof(buf), _TRUNCATE, uimsg2, GetLastError());
 		::MessageBox(NULL, buf, uimsg, MB_OK | MB_ICONWARNING);
 	}
 }
@@ -4226,12 +4136,13 @@
 void CVTWindow::OnReplayLog()
 {
 	OPENFILENAME ofn;
-	char szFile[MAX_PATH];
-	char Command[MAX_PATH] = "notepad.exe";
-	const char *exec = "ttermpro";
-	STARTUPINFO si;
+	TCHAR szFile[MAX_PATH];
+	TCHAR Command[MAX_PATH] = _T("notepad.exe");
+	const TCHAR *exec = _T("ttermpro");
+	STARTUPINFOT si;
 	PROCESS_INFORMATION pi;
-	char uimsg[MAX_UIMSG];
+	TCHAR uimsg[MAX_UIMSG];
+	TCHAR uimsg2[MAX_UIMSG];
 
 	// \x83o\x83C\x83i\x83\x8A\x83\x82\x81[\x83h\x82ō̎悵\x82\xBD\x83\x8D\x83O\x83t\x83@\x83C\x83\x8B\x82\xF0\x91I\x91\xF0\x82\xB7\x82\xE9
 	memset(&ofn, 0, sizeof(OPENFILENAME));
@@ -4238,35 +4149,35 @@
 	memset(szFile, 0, sizeof(szFile));
 	ofn.lStructSize = get_OPENFILENAME_SIZE();
 	ofn.hwndOwner = HVTWin;
-	get_lang_msg("FILEDLG_OPEN_LOGFILE_FILTER", ts.UIMsg, sizeof(ts.UIMsg),
-	             "all(*.*)\\0*.*\\0\\0", ts.UILanguageFile);
-	ofn.lpstrFilter = ts.UIMsg;
+	get_lang_msgT("FILEDLG_OPEN_LOGFILE_FILTER", uimsg, _countof(uimsg),
+				  _T("all(*.*)\\0*.*\\0\\0"), ts.UILanguageFile);
+	ofn.lpstrFilter = uimsg;
 	ofn.lpstrFile = szFile;
 	ofn.nMaxFile = sizeof(szFile);
 	ofn.Flags = OFN_FILEMUSTEXIST | OFN_HIDEREADONLY;
-	ofn.lpstrDefExt = "log";
-	get_lang_msg("FILEDLG_OPEN_LOGFILE_TITLE", uimsg, sizeof(uimsg),
-	             "Select replay log file with binary mode", ts.UILanguageFile);
-	ofn.lpstrTitle = uimsg;
+	ofn.lpstrDefExt = _T("log");
+	get_lang_msgT("FILEDLG_OPEN_LOGFILE_TITLE", uimsg2, _countof(uimsg2),
+	             _T("Select replay log file with binary mode"), ts.UILanguageFile);
+	ofn.lpstrTitle = uimsg2;
 	if(GetOpenFileName(&ofn) == 0)
 		return;
 
 
 	// "/R"\x83I\x83v\x83V\x83\x87\x83\x93\x95t\x82\xAB\x82\xC5Tera Term\x82\xF0\x8BN\x93\xAE\x82\xB7\x82\xE9\x81i\x83\x8D\x83O\x82\xAA\x8DĐ\xB6\x82\xB3\x82\xEA\x82\xE9\x81j
-	_snprintf_s(Command, sizeof(Command), _TRUNCATE,
-	            "%s /R=\"%s\"", exec, szFile);
+	_sntprintf_s(Command, _countof(Command), _TRUNCATE,
+	            _T("%s /R=\"%s\""), exec, szFile);
 
 	memset(&si, 0, sizeof(si));
-	GetStartupInfo(&si);
+	GetStartupInfoT(&si);
 	memset(&pi, 0, sizeof(pi));
 
-	if (CreateProcess(NULL, Command, NULL, NULL, FALSE, 0,
-	                  NULL, NULL, &si, &pi) == 0) {
-		char buf[80];
-		get_lang_msg("MSG_ERROR", uimsg, sizeof(uimsg), "ERROR", ts.UILanguageFile);
-		get_lang_msg("MSG_EXEC_TT_ERROR", ts.UIMsg, sizeof(ts.UIMsg),
-		             "Can't execute Tera Term. (%d)", ts.UILanguageFile);
-		_snprintf_s(buf, sizeof(buf), _TRUNCATE, ts.UIMsg, GetLastError());
+	if (CreateProcessT(NULL, Command, NULL, NULL, FALSE, 0,
+					   NULL, NULL, &si, &pi) == 0) {
+		TCHAR buf[80];
+		get_lang_msgT("MSG_ERROR", uimsg, _countof(uimsg), _T("ERROR"), ts.UILanguageFile);
+		get_lang_msgT("MSG_EXEC_TT_ERROR", uimsg2, _countof(uimsg2),
+					  _T("Can't execute Tera Term. (%d)"), ts.UILanguageFile);
+		_sntprintf_s(buf, _countof(buf), _TRUNCATE, uimsg2, GetLastError());
 		::MessageBox(NULL, buf, uimsg, MB_OK | MB_ICONWARNING);
 	}
 }
@@ -4382,9 +4293,10 @@
 	if ((cv.PortType==IdTCPIP) &&
 	    ((ts.PortFlag & PF_CONFIRMDISCONN) != 0) &&
 	    (confirm)) {
-		get_lang_msg("MSG_DISCONNECT_CONF", ts.UIMsg, sizeof(ts.UIMsg),
-		             "Disconnect?", ts.UILanguageFile);
-		if (::MessageBox(HVTWin, ts.UIMsg, "Tera Term",
+		TCHAR uimsg[MAX_UIMSG];
+		get_lang_msgT("MSG_DISCONNECT_CONF", uimsg, _countof(uimsg),
+					  _T("Disconnect?"), ts.UILanguageFile);
+		if (::MessageBox(HVTWin, uimsg, _T("Tera Term"),
 		                 MB_OKCANCEL | MB_ICONEXCLAMATION | MB_DEFBUTTON2)==IDCANCEL) {
 			return;
 		}
@@ -4499,7 +4411,7 @@
 {
 	DWORD ret;
 
-	CAddSettingPropSheetDlg CAddSetting(hInst, "Tera Term: Additional settings", HVTWin);
+	CAddSettingPropSheetDlg CAddSetting(hInst, _T("Tera Term: Additional settings"), HVTWin);
 	ret = CAddSetting.DoModal();
 	switch (ret) {
 		case (DWORD)-1:
@@ -4694,11 +4606,12 @@
 	// \x8F\x91\x82\xAB\x8D\x9E\x82݂ł\xAB\x82邩\x82̔\xBB\x95ʂ\xF0\x92lj\xC1 (2005.11.3 yutaka)
 	if ((ret = _access(ts.SetupFName, 0x02)) != 0) {
 		if (errno != ENOENT) {  // \x83t\x83@\x83C\x83\x8B\x82\xAA\x82\xB7\x82łɑ\xB6\x8D݂\xB7\x82\xE9\x8Fꍇ\x82̂݃G\x83\x89\x81[\x82Ƃ\xB7\x82\xE9 (2005.12.13 yutaka)
-			char uimsg[MAX_UIMSG];
-			get_lang_msg("MSG_TT_ERROR", uimsg, sizeof(uimsg), "Tera Term: ERROR", ts.UILanguageFile);
-			get_lang_msg("MSG_SAVESETUP_PERMISSION_ERROR", ts.UIMsg, sizeof(ts.UIMsg),
-			             "TERATERM.INI file doesn't have the writable permission.", ts.UILanguageFile);
-			MessageBox(ts.UIMsg, uimsg, MB_OK|MB_ICONEXCLAMATION);
+			TCHAR uimsg[MAX_UIMSG];
+			TCHAR uimsg2[MAX_UIMSG];
+			get_lang_msgT("MSG_TT_ERROR", uimsg, _countof(uimsg), _T("Tera Term: ERROR"), ts.UILanguageFile);
+			get_lang_msgT("MSG_SAVESETUP_PERMISSION_ERROR", uimsg2, _countof(uimsg2),
+						  _T("TERATERM.INI file doesn't have the writable permission."), ts.UILanguageFile);
+			MessageBoxT(uimsg2, uimsg, MB_OK|MB_ICONEXCLAMATION);
 			return;
 		}
 	}
@@ -4716,7 +4629,7 @@
 		}
 #endif
 
-		CopyFile(TmpSetupFN, ts.SetupFName, TRUE);
+		CopyFileA(TmpSetupFN, ts.SetupFName, TRUE);
 		/* write current setup values to file */
 		(*WriteIniFile)(ts.SetupFName,&ts);
 		/* copy host list */
@@ -4765,8 +4678,9 @@
 	STARTUPINFO si;
 	PROCESS_INFORMATION pi;
 	BOOL ret = FALSE;
-	char buf[80];
-	char uimsg[MAX_UIMSG];
+	TCHAR buf[80];
+	TCHAR uimsg[MAX_UIMSG];
+	TCHAR uimsg2[80];
 
 	SetLastError(NO_ERROR);
 
@@ -4773,10 +4687,10 @@
 	_snprintf_s(fullpath, sizeof(fullpath), "%s\\%s", pathname, filename);
 	if (_access(fullpath, 0) != 0) { // \x83t\x83@\x83C\x83\x8B\x82\xAA\x91\xB6\x8D݂\xB5\x82Ȃ\xA2
 		DWORD no = GetLastError();
-		get_lang_msg("MSG_ERROR", uimsg, sizeof(uimsg), "ERROR", ts.UILanguageFile);
-		get_lang_msg("DLG_SETUPDIR_NOFILE_ERROR", ts.UIMsg, sizeof(ts.UIMsg),
-			"File does not exist.(%d)", ts.UILanguageFile);
-		_snprintf_s(buf, sizeof(buf), _TRUNCATE, ts.UIMsg, no);
+		get_lang_msgT("MSG_ERROR", uimsg, _countof(uimsg), _T("ERROR"), ts.UILanguageFile);
+		get_lang_msgT("DLG_SETUPDIR_NOFILE_ERROR", uimsg2, _countof(uimsg2),
+					  _T("File does not exist.(%d)"), ts.UILanguageFile);
+		_sntprintf_s(buf, _countof(buf), _TRUNCATE, uimsg2, no);
 		::MessageBox(NULL, buf, uimsg, MB_OK | MB_ICONWARNING);
 		goto error;
 	}
@@ -4790,10 +4704,10 @@
 	if (CreateProcess(NULL, command, NULL, NULL, FALSE, 0,
 		NULL, NULL, &si, &pi) == 0) { // \x8BN\x93\xAE\x8E\xB8\x94s
 		DWORD no = GetLastError();
-		get_lang_msg("MSG_ERROR", uimsg, sizeof(uimsg), "ERROR", ts.UILanguageFile);
-		get_lang_msg("DLG_SETUPDIR_OPENFILE_ERROR", ts.UIMsg, sizeof(ts.UIMsg),
-			"Cannot open file.(%d)", ts.UILanguageFile);
-		_snprintf_s(buf, sizeof(buf), _TRUNCATE, ts.UIMsg, no);
+		get_lang_msgT("MSG_ERROR", uimsg, _countof(uimsg), _T("ERROR"), ts.UILanguageFile);
+		get_lang_msgT("DLG_SETUPDIR_OPENFILE_ERROR", uimsg2, _countof(uimsg2),
+					  _T("Cannot open file.(%d)"), ts.UILanguageFile);
+		_sntprintf_s(buf, _countof(buf), _TRUNCATE, uimsg2, no);
 		::MessageBox(NULL, buf, uimsg, MB_OK | MB_ICONWARNING);
 		goto error;
 	}
@@ -4915,7 +4829,7 @@
 	if (SHGetSpecialFolderLocation(NULL, CSIDL, &pidl) != S_OK) {
 		goto error;
 	}
-	SHGetPathFromIDList(pidl, shPath);
+	SHGetPathFromIDListA(pidl, shPath);
 	CoTaskMemFree(pidl);
 
 	// Virtual Store\x83p\x83X\x82\xF0\x8D\xEC\x82\xE9\x81B
@@ -4975,7 +4889,7 @@
 		// I18N
 		SetDlgTexts(hDlgWnd, TextInfos, _countof(TextInfos), ts.UILanguageFile);
 
-		if (GetModuleFileName(NULL, temp, sizeof(temp)) != 0) {
+		if (GetModuleFileNameA(NULL, temp, sizeof(temp)) != 0) {
 			ExtractDirName(temp, teratermexepath);
 		}
 
@@ -5058,7 +4972,7 @@
 
 		// ssh_known_hosts
 		if (func == NULL) {
-			if (((h = GetModuleHandle("ttxssh.dll")) != NULL)) {
+			if (((h = GetModuleHandleA("ttxssh.dll")) != NULL)) {
 				func = (PSSH_read_known_hosts_file)GetProcAddress(h, "TTXReadKnownHostsFile");
 				if (func) {
 					int ret = func(temp, sizeof(temp));
@@ -5314,7 +5228,7 @@
 	SendDlgItemMessage(Dialog, IDC_COMMAND_EDIT, CB_RESETCONTENT, 0, 0);
 	do {
 		_snprintf_s(EntName, sizeof(EntName), _TRUNCATE, "Command%d", i);
-		GetPrivateProfileString("BroadcastCommands",EntName,"",
+		GetPrivateProfileStringA("BroadcastCommands",EntName,"",
 		                        Command,sizeof(Command), historyfile);
 		if (strlen(Command) > 0) {
 			SendDlgItemMessage(Dialog, IDC_COMMAND_EDIT, CB_ADDSTRING,
@@ -5348,7 +5262,7 @@
 
 		case WM_LBUTTONUP:
 			// \x82\xB7\x82łɃe\x83L\x83X\x83g\x82\xAA\x93\xFC\x97͂\xB3\x82\xEA\x82Ă\xA2\x82\xE9\x8Fꍇ\x82́A\x83J\x81[\x83\\x83\x8B\x82𖖔\xF6\x82ֈړ\xAE\x82\xB3\x82\xB9\x82\xE9\x81B
-			len = GetWindowText(dlg, buf, sizeof(buf));
+			len = GetWindowTextA(dlg, buf, sizeof(buf));
 			SendMessage(dlg, EM_SETSEL, len, len);
 			SetFocus(dlg);
 			break;
@@ -5369,7 +5283,7 @@
 				int count;
 
 				if (wParam == 0x0d) {  // Enter key
-					SetWindowText(dlg, "");
+					SetWindowText(dlg, _T(""));
 					SendMessage(dlg, EM_SETSEL, 0, 0);
 				}
 
@@ -5720,7 +5634,7 @@
 							goto skip;
 						}
 
-						ret = GetDlgItemText(hWnd, IDC_COMMAND_EDIT, buf, 256 - 1);
+						ret = GetDlgItemTextA(hWnd, IDC_COMMAND_EDIT, buf, sizeof(buf) - 1);
 						if (ret == 0) { // error
 							memset(buf, 0, sizeof(buf));
 						}

Modified: branches/cmake/teraterm/teraterm/vtwin.h
===================================================================
--- branches/cmake/teraterm/teraterm/vtwin.h	2018-11-17 15:43:03 UTC (rev 7262)
+++ branches/cmake/teraterm/teraterm/vtwin.h	2018-11-17 15:43:21 UTC (rev 7263)
@@ -32,7 +32,7 @@
 #ifdef __cplusplus
 
 #include "tmfc.h"
-//class CVTWindow : public CFrameWnd
+
 class CVTWindow : public TTCFrameWnd
 {
 private:
@@ -53,7 +53,7 @@
     SetupMenu, ControlMenu, WinMenu, HelpMenu;
 
   // drag and drop handle
-  char **DropLists;
+  TCHAR **DropLists;
   int DropListCount;
   void DropListFree();
 

Modified: branches/cmake/teraterm/teraterm/winjump.c
===================================================================
--- branches/cmake/teraterm/teraterm/winjump.c	2018-11-17 15:43:03 UTC (rev 7262)
+++ branches/cmake/teraterm/teraterm/winjump.c	2018-11-17 15:43:21 UTC (rev 7263)
@@ -46,6 +46,9 @@
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+#undef UNICODE
+#undef _UNICODE
+
 #include <windows.h>
 #include <assert.h>
 #include <stdio.h>

Modified: branches/cmake/teraterm/ttpdlg/ttdlg.c
===================================================================
--- branches/cmake/teraterm/ttpdlg/ttdlg.c	2018-11-17 15:43:03 UTC (rev 7262)
+++ branches/cmake/teraterm/ttpdlg/ttdlg.c	2018-11-17 15:43:21 UTC (rev 7263)
@@ -29,6 +29,7 @@
 /* IPv6 modification is Copyright(C) 2000 Jun-ya Kato <kato****@win6*****> */
 
 /* TTDLG.DLL, dialog boxes */
+
 #include <winsock2.h>
 #include <stdio.h>
 #include <string.h>
@@ -37,6 +38,7 @@
 #include <direct.h>
 #include <commdlg.h>
 #include <dlgs.h>
+#include <tchar.h>
 #include "teraterm.h"
 #include "tttypes.h"
 #include "ttlib.h"
@@ -77,9 +79,9 @@
 
 static char UILanguageFile[MAX_PATH];
 
-static const TCHAR *NLListRcv[] = {"CR","CR+LF", "LF", "AUTO", NULL};
-static const TCHAR *NLList[] = {"CR","CR+LF", "LF", NULL};
-static const TCHAR *TermList[] =
+static const char *NLListRcv[] = {"CR","CR+LF", "LF", "AUTO", NULL};
+static const char *NLList[] = {"CR","CR+LF", "LF", NULL};
+static const char *TermList[] =
 	{"VT100", "VT101", "VT102", "VT282", "VT320", "VT382",
 	 "VT420", "VT520", "VT525", NULL};
 static WORD Term_TermJ[] =
@@ -86,29 +88,29 @@
 	{IdVT100, IdVT101, IdVT102, IdVT282, IdVT320, IdVT382,
 	 IdVT420, IdVT520, IdVT525};
 static WORD TermJ_Term[] = {1, 1, 2, 3, 3, 4, 4, 5, 6, 7, 8, 9};
-static const TCHAR *TermListJ[] =
+static const char *TermListJ[] =
 	{"VT100", "VT100J", "VT101", "VT102", "VT102J", "VT220J", "VT282",
 	 "VT320", "VT382", "VT420", "VT520", "VT525", NULL};
-static const TCHAR *KanjiList[] = {"SJIS","EUC","JIS", "UTF-8", "UTF-8m", NULL};
-static const TCHAR *KanjiListSend[] = {"SJIS","EUC","JIS", "UTF-8", NULL};
-static const TCHAR *KanjiInList[] = {"^[$@","^[$B",NULL};
-static const TCHAR *KanjiOutList[] = {"^[(B","^[(J",NULL};
-static const TCHAR *KanjiOutList2[] = {"^[(B","^[(J","^[(H",NULL};
-static const TCHAR *RussList[] = {"Windows","KOI8-R","CP 866","ISO 8859-5",NULL};
-static const TCHAR *RussList2[] = {"Windows","KOI8-R",NULL};
+static const char *KanjiList[] = {"SJIS","EUC","JIS", "UTF-8", "UTF-8m", NULL};
+static const char *KanjiListSend[] = {"SJIS","EUC","JIS", "UTF-8", NULL};
+static const char *KanjiInList[] = {"^[$@","^[$B",NULL};
+static const char *KanjiOutList[] = {"^[(B","^[(J",NULL};
+static const char *KanjiOutList2[] = {"^[(B","^[(J","^[(H",NULL};
+static const char *RussList[] = {"Windows","KOI8-R","CP 866","ISO 8859-5",NULL};
+static const char *RussList2[] = {"Windows","KOI8-R",NULL};
 //static const TCHAR *LocaleList[] = {"japanese","chinese", "chinese-simplified", "chinese-traditional", NULL};
-static const TCHAR *MetaList[] = {"off", "on", "left", "right", NULL};
-static const TCHAR *MetaList2[] = {"off", "on", NULL};
+static const char *MetaList[] = {"off", "on", "left", "right", NULL};
+static const char *MetaList2[] = {"off", "on", NULL};
 
 // HKS
-static const TCHAR *KoreanList[] = {"KS5601", "UTF-8", "UTF-8m", NULL};
-static const TCHAR *KoreanListSend[] = {"KS5601", "UTF-8", NULL};
+static const char *KoreanList[] = {"KS5601", "UTF-8", "UTF-8m", NULL};
+static const char *KoreanListSend[] = {"KS5601", "UTF-8", NULL};
 
 // UTF-8
-static const TCHAR *Utf8List[] = {"UTF-8", "UTF-8m", NULL};
-static const TCHAR *Utf8ListSend[] = {"UTF-8", NULL};
+static const char *Utf8List[] = {"UTF-8", "UTF-8m", NULL};
+static const char *Utf8ListSend[] = {"UTF-8", NULL};
 
-static const TCHAR *BaudList[] =
+static const char *BaudList[] =
 	{"110","300","600","1200","2400","4800","9600",
 	 "14400","19200","38400","57600","115200",
 	 "230400", "460800", "921600", NULL};
@@ -211,7 +213,7 @@
 			else {
 				Str2Hex(ts->Answerback,Temp,ts->AnswerbackLen,
 					sizeof(Temp)-1,FALSE);
-				SetDlgItemText(Dialog, IDC_TERMANSBACK, Temp);
+				SetDlgItemTextA(Dialog, IDC_TERMANSBACK, Temp);
 				SendDlgItemMessage(Dialog, IDC_TERMANSBACK, EM_LIMITTEXT,
 					sizeof(Temp) - 1, 0);
 			}
@@ -238,7 +240,7 @@
 				}
 
 				// \x83\x8D\x83P\x81[\x83\x8B\x97p\x83e\x83L\x83X\x83g\x83{\x83b\x83N\x83X
-				SetDlgItemText(Dialog, IDC_LOCALE_EDIT, ts->Locale);
+				SetDlgItemTextA(Dialog, IDC_LOCALE_EDIT, ts->Locale);
 				SendDlgItemMessage(Dialog, IDC_LOCALE_EDIT, EM_LIMITTEXT, sizeof(ts->Locale), 0);
 
 				SetDlgItemInt(Dialog, IDC_CODEPAGE_EDIT, ts->CodePage, FALSE);
@@ -253,7 +255,7 @@
 				SetDropDownList(Dialog, IDC_TERMKANJISEND, KoreanListSend, KanjiCode2List(ts->Language,ts->KanjiCodeSend));
 
 				// \x83\x8D\x83P\x81[\x83\x8B\x97p\x83e\x83L\x83X\x83g\x83{\x83b\x83N\x83X
-				SetDlgItemText(Dialog, IDC_LOCALE_EDIT, ts->Locale);
+				SetDlgItemTextA(Dialog, IDC_LOCALE_EDIT, ts->Locale);
 				SendDlgItemMessage(Dialog, IDC_LOCALE_EDIT, EM_LIMITTEXT, sizeof(ts->Locale), 0);
 
 				SetDlgItemInt(Dialog, IDC_CODEPAGE_EDIT, ts->CodePage, FALSE);
@@ -263,7 +265,7 @@
 				SetDropDownList(Dialog, IDC_TERMKANJISEND, Utf8ListSend, KanjiCode2List(ts->Language,ts->KanjiCodeSend));
 
 				// \x83\x8D\x83P\x81[\x83\x8B\x97p\x83e\x83L\x83X\x83g\x83{\x83b\x83N\x83X
-				SetDlgItemText(Dialog, IDC_LOCALE_EDIT, ts->Locale);
+				SetDlgItemTextA(Dialog, IDC_LOCALE_EDIT, ts->Locale);
 				SendDlgItemMessage(Dialog, IDC_LOCALE_EDIT, EM_LIMITTEXT, sizeof(ts->Locale), 0);
 
 				SetDlgItemInt(Dialog, IDC_CODEPAGE_EDIT, ts->CodePage, FALSE);
@@ -321,7 +323,7 @@
 						GetRB(Dialog,&ts->LocalEcho,IDC_TERMLOCALECHO,IDC_TERMLOCALECHO);
 
 						if ((ts->FTFlag & FT_BPAUTO)==0) {
-							GetDlgItemText(Dialog, IDC_TERMANSBACK,Temp,sizeof(Temp));
+							GetDlgItemTextA(Dialog, IDC_TERMANSBACK,Temp,sizeof(Temp));
 							ts->AnswerbackLen = Hex2Str(Temp,ts->Answerback,sizeof(ts->Answerback));
 						}
 
@@ -345,7 +347,7 @@
 								ts->KanjiOut = w;
 							}
 
-							GetDlgItemText(Dialog, IDC_LOCALE_EDIT, ts->Locale, sizeof(ts->Locale));
+							GetDlgItemTextA(Dialog, IDC_LOCALE_EDIT, ts->Locale, sizeof(ts->Locale));
 							ts->CodePage = GetDlgItemInt(Dialog, IDC_CODEPAGE_EDIT, &ret, FALSE);
 						}
 						else if (ts->Language==IdRussian) {
@@ -375,7 +377,7 @@
 							ts->KanjiIn = 0;
 							ts->KanjiOut = 0;
 
-							GetDlgItemText(Dialog, IDC_LOCALE_EDIT, ts->Locale, sizeof(ts->Locale));
+							GetDlgItemTextA(Dialog, IDC_LOCALE_EDIT, ts->Locale, sizeof(ts->Locale));
 							ts->CodePage = GetDlgItemInt(Dialog, IDC_CODEPAGE_EDIT, &ret, FALSE);
 						}
 
@@ -463,7 +465,7 @@
 #endif
 	x = (int)((TestRect.left+TestRect.right) / 2 - FW * 1.5);
 	y = (TestRect.top+TestRect.bottom-FH) / 2;
-	ExtTextOut(DC, x,y, ETO_CLIPPED | ETO_OPAQUE,
+	ExtTextOutA(DC, x,y, ETO_CLIPPED | ETO_OPAQUE,
 	           &TestRect, "ABC", 3, &(DX[0]));
 	ReleaseDC(Dialog,DC);
 }
@@ -540,6 +542,7 @@
 		{ 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;
@@ -546,7 +549,7 @@
 	int IAttr, IOffset;
 	WORD i, pos, ScrollCode, NewPos;
 	HDC DC;
-	char uimsg[MAX_UIMSG];
+	TCHAR uimsg[MAX_UIMSG];
 
 	switch (Message) {
 		case WM_INITDIALOG:
@@ -554,7 +557,7 @@
 			SetWindowLong(Dialog, DWLP_USER, lParam);
 
 			SetDlgTexts(Dialog, TextInfos, _countof(TextInfos), UILanguageFile);
-			SetDlgItemText(Dialog, IDC_WINTITLE, ts->Title);
+			SetDlgItemTextA(Dialog, IDC_WINTITLE, ts->Title);
 			SendDlgItemMessage(Dialog, IDC_WINTITLE, EM_LIMITTEXT,
 			                   sizeof(ts->Title)-1, 0);
 
@@ -564,8 +567,6 @@
 				DisableDlgItem(Dialog,IDC_WINHIDEMENU,IDC_WINHIDEMENU);
 
 			if (ts->VTFlag>0) {
-				get_lang_msg("DLG_WIN_PCBOLD16", uimsg, sizeof(uimsg), "&16 Colors (PC style)", UILanguageFile);
-				SetDlgItemText(Dialog, IDC_WINCOLOREMU,uimsg);
 				SetRB(Dialog, (ts->ColorFlag&CF_PCBOLD16)!=0, IDC_WINCOLOREMU, IDC_WINCOLOREMU);
 				SetRB(Dialog, (ts->ColorFlag&CF_AIXTERM16)!=0, IDC_WINAIXTERM16, IDC_WINAIXTERM16);
 				SetRB(Dialog, (ts->ColorFlag&CF_XTERM256)!=0,IDC_WINXTERM256,IDC_WINXTERM256);
@@ -641,16 +642,16 @@
 					}
 				}
 				ShowDlgItem(Dialog,IDC_WINATTRTEXT,IDC_WINATTR);
-				get_lang_msg("DLG_WIN_NORMAL", uimsg, sizeof(uimsg), "Normal", UILanguageFile);
+				get_lang_msgT("DLG_WIN_NORMAL", uimsg, sizeof(uimsg), _T("Normal"), UILanguageFile);
 				SendDlgItemMessage(Dialog, IDC_WINATTR, CB_ADDSTRING, 0, (LPARAM)uimsg);
-				get_lang_msg("DLG_WIN_BOLD", uimsg, sizeof(uimsg), "Bold", UILanguageFile);
+				get_lang_msgT("DLG_WIN_BOLD", uimsg, sizeof(uimsg), _T("Bold"), UILanguageFile);
 				SendDlgItemMessage(Dialog, IDC_WINATTR, CB_ADDSTRING, 0, (LPARAM)uimsg);
-				get_lang_msg("DLG_WIN_BLINK", uimsg, sizeof(uimsg), "Blink", UILanguageFile);
+				get_lang_msgT("DLG_WIN_BLINK", uimsg, sizeof(uimsg), _T("Blink"), UILanguageFile);
 				SendDlgItemMessage(Dialog, IDC_WINATTR, CB_ADDSTRING, 0, (LPARAM)uimsg);
-				get_lang_msg("DLG_WIN_REVERSEATTR", uimsg, sizeof(uimsg), "Reverse", UILanguageFile);
+				get_lang_msgT("DLG_WIN_REVERSEATTR", uimsg, sizeof(uimsg), _T("Reverse"), UILanguageFile);
 				SendDlgItemMessage(Dialog, IDC_WINATTR, CB_ADDSTRING, 0, (LPARAM)uimsg);
 				/* begin - ishizaki */
-				SendDlgItemMessage(Dialog, IDC_WINATTR, CB_ADDSTRING, 0, (LPARAM)"URL");
+				SendDlgItemMessage(Dialog, IDC_WINATTR, CB_ADDSTRING, 0, (LPARAM)_T("URL"));
 				/* end - ishizaki */
 				SendDlgItemMessage(Dialog, IDC_WINATTR, CB_SETCURSEL, 0,0);
 #ifdef USE_NORMAL_BGCOLOR
@@ -694,7 +695,7 @@
 			switch (LOWORD(wParam)) {
 				case IDOK:
 					if ( ts!=NULL ) {
-						GetDlgItemText(Dialog,IDC_WINTITLE,ts->Title,sizeof(ts->Title));
+						GetDlgItemTextA(Dialog,IDC_WINTITLE,ts->Title,sizeof(ts->Title));
 						GetRB(Dialog,&ts->HideTitle,IDC_WINHIDETITLE,IDC_WINHIDETITLE);
 						GetRB(Dialog,&ts->PopupMenu,IDC_WINHIDEMENU,IDC_WINHIDEMENU);
 						DC = GetDC(Dialog);
@@ -1101,10 +1102,10 @@
 	return FALSE;
 }
 
-static const TCHAR *DataList[] = {"7 bit","8 bit",NULL};
-static const TCHAR *ParityList[] = {"none", "odd", "even", "mark", "space", NULL};
-static const TCHAR *StopList[] = {"1 bit", "1.5 bit", "2 bit", NULL};
-static const TCHAR *FlowList[] = {"Xon/Xoff","hardware","none",NULL};
+static const char *DataList[] = {"7 bit","8 bit",NULL};
+static const char *ParityList[] = {"none", "odd", "even", "mark", "space", NULL};
+static const char *StopList[] = {"1 bit", "1.5 bit", "2 bit", NULL};
+static const char *FlowList[] = {"Xon/Xoff","hardware","none",NULL};
 
 static BOOL CALLBACK SerialDlg(HWND Dialog, UINT Message, WPARAM wParam, LPARAM lParam)
 {
@@ -1152,7 +1153,7 @@
 					strncat_s(Temp, sizeof(Temp), ": ", _TRUNCATE);
 					strncat_s(Temp, sizeof(Temp), ComPortDesc[i], _TRUNCATE);
 #endif
-					SendDlgItemMessage(Dialog, IDC_SERIALPORT, CB_ADDSTRING,
+					SendDlgItemMessageA(Dialog, IDC_SERIALPORT, CB_ADDSTRING,
 					                   0, (LPARAM)Temp);
 					if (ComPortTable[i] == ts->ComPort) {
 						w = i;
@@ -1164,7 +1165,7 @@
 			} else {
 				for (i=1; i<=ts->MaxComPort; i++) {
 					_snprintf_s(Temp, sizeof(Temp), _TRUNCATE, "COM%d", i);
-					SendDlgItemMessage(Dialog, IDC_SERIALPORT, CB_ADDSTRING,
+					SendDlgItemMessageA(Dialog, IDC_SERIALPORT, CB_ADDSTRING,
 					                   0, (LPARAM)Temp);
 				}
 				if (ts->ComPort<=ts->MaxComPort) {
@@ -1207,12 +1208,12 @@
 					ts = (PTTSet)GetWindowLong(Dialog,DWLP_USER);
 					if ( ts!=NULL ) {
 						memset(Temp, 0, sizeof(Temp));
-						GetDlgItemText(Dialog, IDC_SERIALPORT, Temp, sizeof(Temp)-1);
+						GetDlgItemTextA(Dialog, IDC_SERIALPORT, Temp, sizeof(Temp)-1);
 						if (strncmp(Temp, "COM", 3) == 0 && Temp[3] != '\0') {
 							ts->ComPort = (WORD)atoi(&Temp[3]);
 						}
 
-						GetDlgItemText(Dialog, IDC_SERIALBAUD, Temp, sizeof(Temp)-1);
+						GetDlgItemTextA(Dialog, IDC_SERIALBAUD, Temp, sizeof(Temp)-1);
 						if (atoi(Temp) != 0) {
 							ts->Baud = (DWORD)atoi(Temp);
 						}
@@ -1294,10 +1295,10 @@
 			i = 1;
 			do {
 				_snprintf_s(EntName, sizeof(EntName), _TRUNCATE, "Host%d", i);
-				GetPrivateProfileString("Hosts",EntName,"",
+				GetPrivateProfileStringA("Hosts",EntName,"",
 				                        TempHost,sizeof(TempHost),ts->SetupFName);
 				if (strlen(TempHost) > 0) {
-					SendDlgItemMessage(Dialog, IDC_TCPIPLIST, LB_ADDSTRING,
+					SendDlgItemMessageA(Dialog, IDC_TCPIPLIST, LB_ADDSTRING,
 					                   0, (LPARAM)TempHost);
 				}
 				i++;
@@ -1305,13 +1306,13 @@
 
 			/* append a blank item to the bottom */
 			TempHost[0] = 0;
-			SendDlgItemMessage(Dialog, IDC_TCPIPLIST, LB_ADDSTRING, 0, (LPARAM)TempHost);
+			SendDlgItemMessageA(Dialog, IDC_TCPIPLIST, LB_ADDSTRING, 0, (LPARAM)TempHost);
 			SetRB(Dialog,ts->HistoryList,IDC_TCPIPHISTORY,IDC_TCPIPHISTORY);
 			SetRB(Dialog,ts->AutoWinClose,IDC_TCPIPAUTOCLOSE,IDC_TCPIPAUTOCLOSE);
 			SetDlgItemInt(Dialog,IDC_TCPIPPORT,ts->TCPPort,FALSE);
 			SetDlgItemInt(Dialog,IDC_TCPIPTELNETKEEPALIVE,ts->TelKeepAliveInterval,FALSE);
 			SetRB(Dialog,ts->Telnet,IDC_TCPIPTELNET,IDC_TCPIPTELNET);
-			SetDlgItemText(Dialog, IDC_TCPIPTERMTYPE, ts->TermType);
+			SetDlgItemTextA(Dialog, IDC_TCPIPTERMTYPE, ts->TermType);
 			SendDlgItemMessage(Dialog, IDC_TCPIPTERMTYPE, EM_LIMITTEXT, sizeof(ts->TermType)-1, 0);
 
 			// SSH\x90ڑ\xB1\x82̂Ƃ\xAB\x82ɂ\xE0 TERM \x82𑗂\xE9\x82̂ŁAtelnet\x82\xAA\x96\xB3\x8C\xF8\x82ł\xE0 disabled \x82ɂ\xB5\x82Ȃ\xA2\x81B(2005.11.3 yutaka)
@@ -1324,7 +1325,7 @@
 				case IDOK:
 					ts = (PTTSet)GetWindowLong(Dialog,DWLP_USER);
 					if (ts!=NULL) {
-						WritePrivateProfileString("Hosts",NULL,NULL,ts->SetupFName);
+						WritePrivateProfileStringA("Hosts",NULL,NULL,ts->SetupFName);
 
 						Index = SendDlgItemMessage(Dialog,IDC_TCPIPLIST,LB_GETCOUNT,0,0);
 						if (Index==(UINT)LB_ERR) {
@@ -1337,10 +1338,10 @@
 							Index = MAXHOSTLIST;
 						}
 						for (i = 1 ; i <= Index ; i++) {
-							SendDlgItemMessage(Dialog, IDC_TCPIPLIST, LB_GETTEXT,
+							SendDlgItemMessageA(Dialog, IDC_TCPIPLIST, LB_GETTEXT,
 							                   i-1, (LPARAM)TempHost);
 							_snprintf_s(EntName, sizeof(EntName), _TRUNCATE, "Host%i", i);
-							WritePrivateProfileString("Hosts",EntName,TempHost,ts->SetupFName);
+							WritePrivateProfileStringA("Hosts",EntName,TempHost,ts->SetupFName);
 						}
 						GetRB(Dialog,&ts->HistoryList,IDC_TCPIPHISTORY,IDC_TCPIPHISTORY);
 						GetRB(Dialog,&ts->AutoWinClose,IDC_TCPIPAUTOCLOSE,IDC_TCPIPAUTOCLOSE);
@@ -1350,7 +1351,7 @@
 						}
 						ts->TelKeepAliveInterval = GetDlgItemInt(Dialog,IDC_TCPIPTELNETKEEPALIVE,&Ok,FALSE);
 						GetRB(Dialog,&ts->Telnet,IDC_TCPIPTELNET,IDC_TCPIPTELNET);
-						GetDlgItemText(Dialog, IDC_TCPIPTERMTYPE, ts->TermType,
+						GetDlgItemTextA(Dialog, IDC_TCPIPTERMTYPE, ts->TermType,
 						               sizeof(ts->TermType));
 					}
 					EndDialog(Dialog, 1);
@@ -1362,7 +1363,7 @@
 
 				case IDC_TCPIPHOST:
 					if (HIWORD(wParam)==EN_CHANGE) {
-						GetDlgItemText(Dialog, IDC_TCPIPHOST, TempHost, sizeof(TempHost));
+						GetDlgItemTextA(Dialog, IDC_TCPIPHOST, TempHost, sizeof(TempHost));
 						if (strlen(TempHost)==0) {
 							DisableDlgItem(Dialog,IDC_TCPIPADD,IDC_TCPIPADD);
 						}
@@ -1373,7 +1374,7 @@
 					break;
 
 				case IDC_TCPIPADD:
-					GetDlgItemText(Dialog, IDC_TCPIPHOST, TempHost, sizeof(TempHost));
+					GetDlgItemTextA(Dialog, IDC_TCPIPHOST, TempHost, sizeof(TempHost));
 					if (strlen(TempHost)>0) {
 						Index = SendDlgItemMessage(Dialog,IDC_TCPIPLIST,LB_GETCURSEL,0,0);
 						if (Index==(UINT)LB_ERR) {
@@ -1380,7 +1381,7 @@
 							Index = 0;
 						}
 
-						SendDlgItemMessage(Dialog, IDC_TCPIPLIST, LB_INSERTSTRING,
+						SendDlgItemMessageA(Dialog, IDC_TCPIPLIST, LB_INSERTSTRING,
 						                   Index, (LPARAM)TempHost);
 
 						SetDlgItemText(Dialog, IDC_TCPIPHOST, 0);
@@ -1426,11 +1427,11 @@
 					if ((Index==0) || (Index>=i-1)) {
 						return TRUE;
 					}
-					SendDlgItemMessage(Dialog, IDC_TCPIPLIST, LB_GETTEXT,
+					SendDlgItemMessageA(Dialog, IDC_TCPIPLIST, LB_GETTEXT,
 					                   Index, (LPARAM)TempHost);
 					SendDlgItemMessage(Dialog, IDC_TCPIPLIST, LB_DELETESTRING,
 					                   Index, 0);
-					SendDlgItemMessage(Dialog, IDC_TCPIPLIST, LB_INSERTSTRING,
+					SendDlgItemMessageA(Dialog, IDC_TCPIPLIST, LB_INSERTSTRING,
 					                   Index-1, (LPARAM)TempHost);
 					if (LOWORD(wParam)==IDC_TCPIPUP) {
 						Index--;
@@ -1462,7 +1463,7 @@
 					                   Index, (LPARAM)TempHost);
 					SendDlgItemMessage(Dialog, IDC_TCPIPLIST, LB_DELETESTRING,
 					                   Index, 0);
-					SetDlgItemText(Dialog, IDC_TCPIPHOST, TempHost);
+					SetDlgItemTextA(Dialog, IDC_TCPIPHOST, TempHost);
 					DisableDlgItem(Dialog,IDC_TCPIPUP,IDC_TCPIPDOWN);
 					SetFocus(GetDlgItem(Dialog, IDC_TCPIPHOST));
 					break;
@@ -1529,10 +1530,10 @@
 			i = 1;
 			do {
 				_snprintf_s(EntName, sizeof(EntName), _TRUNCATE, "Host%d", i);
-				GetPrivateProfileString("Hosts",EntName,"",
+				GetPrivateProfileStringA("Hosts",EntName,"",
 				                        TempHost,sizeof(TempHost),GetHNRec->SetupFN);
 				if ( strlen(TempHost) > 0 ) {
-					SendDlgItemMessage(Dialog, IDC_HOSTNAME, CB_ADDSTRING,
+					SendDlgItemMessageA(Dialog, IDC_HOSTNAME, CB_ADDSTRING,
 					                   0, (LPARAM)TempHost);
 				}
 				i++;
@@ -1549,7 +1550,7 @@
 			SendDlgItemMessage(Dialog, IDC_HOSTTCPPORT, EM_LIMITTEXT,5,0);
 			SetDlgItemInt(Dialog,IDC_HOSTTCPPORT,GetHNRec->TCPPort,FALSE);
 			for (i=0; ProtocolFamilyList[i]; ++i) {
-				SendDlgItemMessage(Dialog, IDC_HOSTTCPPROTOCOL, CB_ADDSTRING,
+				SendDlgItemMessageA(Dialog, IDC_HOSTTCPPROTOCOL, CB_ADDSTRING,
 				                   0, (LPARAM)ProtocolFamilyList[i]);
 			}
 			SendDlgItemMessage(Dialog, IDC_HOSTTCPPROTOCOL, EM_LIMITTEXT,
@@ -1575,7 +1576,7 @@
 						strncat_s(EntName, sizeof(EntName), ": ", _TRUNCATE);
 						strncat_s(EntName, sizeof(EntName), ComPortDesc[i], _TRUNCATE);
 					}
-					SendDlgItemMessage(Dialog, IDC_HOSTCOM, CB_ADDSTRING,
+					SendDlgItemMessageA(Dialog, IDC_HOSTCOM, CB_ADDSTRING,
 					                   0, (LPARAM)EntName);
 					j++;
 					if (GetHNRec->ComPort==ComPortTable[i]) {
@@ -1589,7 +1590,7 @@
 						continue;
 					}
 					_snprintf_s(EntName, sizeof(EntName), _TRUNCATE, "COM%d", i);
-					SendDlgItemMessage(Dialog, IDC_HOSTCOM, CB_ADDSTRING,
+					SendDlgItemMessageA(Dialog, IDC_HOSTCOM, CB_ADDSTRING,
 					                   0, (LPARAM)EntName);
 					j++;
 					if (GetHNRec->ComPort==i) {
@@ -1625,7 +1626,7 @@
 						char afstr[BUFSIZ];
 						GetRB(Dialog,&GetHNRec->PortType,IDC_HOSTTCPIP,IDC_HOSTSERIAL);
 						if ( GetHNRec->PortType==IdTCPIP ) {
-							GetDlgItemText(Dialog, IDC_HOSTNAME, GetHNRec->HostName, HostNameMaxLength);
+							GetDlgItemTextA(Dialog, IDC_HOSTNAME, GetHNRec->HostName, HostNameMaxLength);
 						}
 						else {
 							GetHNRec->HostName[0] = 0;
@@ -1639,10 +1640,10 @@
 	((strcmp((str), "IPv6") == 0) ? AF_INET6 : \
 	((strcmp((str), "IPv4") == 0) ? AF_INET : AF_UNSPEC))
 						memset(afstr, 0, sizeof(afstr));
-						GetDlgItemText(Dialog, IDC_HOSTTCPPROTOCOL, afstr, sizeof(afstr));
+						GetDlgItemTextA(Dialog, IDC_HOSTTCPPROTOCOL, afstr, sizeof(afstr));
 						GetHNRec->ProtocolFamily = getaf(afstr);
 						memset(EntName,0,sizeof(EntName));
-						GetDlgItemText(Dialog, IDC_HOSTCOM, EntName, sizeof(EntName)-1);
+						GetDlgItemTextA(Dialog, IDC_HOSTCOM, EntName, sizeof(EntName)-1);
 						if (strncmp(EntName, "COM", 3) == 0 && EntName[3] != '\0') {
 #if 0
 							GetHNRec->ComPort = (BYTE)(EntName[3])-0x30;
@@ -1700,7 +1701,7 @@
 							len = SendMessage(hostcom, CB_GETLBTEXTLEN, i, 0);
 							lbl = (char *)calloc(len+1, sizeof(char));
 							SendMessage(hostcom, CB_GETLBTEXT, i, (LPARAM)lbl);
-							GetTextExtentPoint32(TmpDC, lbl, len, &s);
+							GetTextExtentPoint32A(TmpDC, lbl, len, &s);
 							if (s.cx > max_len) {
 								max_len = s.cx;
 							}
@@ -1748,7 +1749,7 @@
 			CurDir = (PCHAR)(lParam);
 			SetWindowLong(Dialog, DWLP_USER, lParam);
 
-			SetDlgItemText(Dialog, IDC_DIRCURRENT, CurDir);
+			SetDlgItemTextA(Dialog, IDC_DIRCURRENT, CurDir);
 			SendDlgItemMessage(Dialog, IDC_DIRNEW, EM_LIMITTEXT,
 			                   MAXPATHLEN-1, 0);
 
@@ -1761,7 +1762,7 @@
 			ScreenToClient(Dialog,&D);
 			DH = R.bottom-R.top;
 			TmpDC = GetDC(Dialog);
-			GetTextExtentPoint32(TmpDC,CurDir,strlen(CurDir),&s);
+			GetTextExtentPoint32A(TmpDC,CurDir,strlen(CurDir),&s);
 			ReleaseDC(Dialog,TmpDC);
 			DW = s.cx + s.cx/10;
 
@@ -1829,12 +1830,12 @@
 					if ( CurDir!=NULL ) {
 						_getcwd(HomeDir,sizeof(HomeDir));
 						_chdir(CurDir);
-						GetDlgItemText(Dialog, IDC_DIRNEW, TmpDir, sizeof(TmpDir));
+						GetDlgItemTextA(Dialog, IDC_DIRNEW, TmpDir, sizeof(TmpDir));
 						if ( strlen(TmpDir)>0 ) {
 							if (_chdir(TmpDir) != 0) {
 								get_lang_msg("MSG_TT_ERROR", uimsg2, sizeof(uimsg2), "Tera Term: Error", UILanguageFile);
 								get_lang_msg("MSG_FIND_DIR_ERROR", uimsg, sizeof(uimsg), "Cannot find directory", UILanguageFile);
-								MessageBox(Dialog,uimsg,uimsg2,MB_ICONEXCLAMATION);
+								MessageBoxA(Dialog,uimsg,uimsg2,MB_ICONEXCLAMATION);
 								_chdir(HomeDir);
 								return TRUE;
 							}
@@ -1852,9 +1853,9 @@
 				case IDC_SELECT_DIR:
 					get_lang_msg("DLG_SELECT_DIR_TITLE", uimsg, sizeof(uimsg),
 					             "Select new directory", UILanguageFile);
-					GetDlgItemText(Dialog, IDC_DIRNEW, buf, sizeof(buf));
+					GetDlgItemTextA(Dialog, IDC_DIRNEW, buf, sizeof(buf));
 					if (doSelectFolder(Dialog, buf2, sizeof(buf2), buf, uimsg)) {
-						SetDlgItemText(Dialog, IDC_DIRNEW, buf2);
+						SetDlgItemTextA(Dialog, IDC_DIRNEW, buf2);
 					}
 					return TRUE;
 
@@ -1919,7 +1920,7 @@
 			// get URL
 			SendMessage(hWnd, WM_GETTEXT , sizeof(url), (LPARAM)url);
 			// kick WWW browser
-			ShellExecute(NULL, NULL, url, NULL, NULL,SW_SHOWNORMAL);
+			ShellExecuteA(NULL, NULL, url, NULL, NULL,SW_SHOWNORMAL);
 		}
 		break;
 
@@ -2122,12 +2123,15 @@
 #elif defined(__MINGW32__)
 static void GetCompilerInfo(char *buf, size_t buf_size)
 {
+#if defined(__GNUC__) || defined(__clang__) 
+	_snprintf_s(buf, buf_size, _TRUNCATE,
+				"mingw " __MINGW64_VERSION_STR " "
 #if defined(__clang__)
-	strncpy_s(buf, buf_size, "mingw clang " __clang_version__, _TRUNCATE);
+				"clang " __clang_version__
 #elif defined(__GNUC__)
-	_snprintf_s(buf, buf_size, _TRUNCATE, "mingw gcc %s(%d.%d.%d)",
-				__VERSION__,
-				__GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__);
+				"gcc " __VERSION__
+#endif
+		);
 #else
 	strncat_s(buf, buf_size, "mingw", _TRUNCATE);
 #endif
@@ -2142,6 +2146,9 @@
 
 static BOOL 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;
@@ -2149,7 +2156,7 @@
 	DWORD dwExt;
 	WORD w, h;
 	POINT point;
-	char uimsg[MAX_UIMSG], uimsg2[MAX_UIMSG];
+	char uimsg[MAX_UIMSG];
 
 #if defined(EFFECT_ENABLED) || defined(TEXTURE_ENABLED)
 	// for animation
@@ -2197,20 +2204,20 @@
 #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);
 #ifdef SVNVERSION
 			_snprintf_s(tmpbuf, sizeof(tmpbuf), _TRUNCATE, " (SVN# %d)", SVNVERSION);
-			strncat_s(buf, sizeof(buf), tmpbuf, _TRUNCATE);
 #else
 			_snprintf_s(tmpbuf, sizeof(tmpbuf), _TRUNCATE, " (SVN# UNK)");
+#endif
 			strncat_s(buf, sizeof(buf), tmpbuf, _TRUNCATE);
+#if defined(UNICODE)
+			strncat_s(buf, sizeof(buf), " unicode", _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
@@ -2220,22 +2227,22 @@
 			// \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)
 			GetCompilerInfo(tmpbuf, sizeof(tmpbuf));
 			_snprintf_s(buf, sizeof(buf), _TRUNCATE, "Built using %s", tmpbuf);
-			SendMessage(GetDlgItem(Dialog, IDC_BUILDTOOL), WM_SETTEXT, 0, (LPARAM)buf);
+			SetDlgItemTextA(Dialog, IDC_BUILDTOOL, buf);
 
 			// \x83r\x83\x8B\x83h\x83^\x83C\x83\x80\x82\xF0\x90ݒ肷\x82\xE9\x81B(2009.3.4 yutaka)
 			_snprintf_s(buf, sizeof(buf), _TRUNCATE, "Build time: %s %s", __DATE__, __TIME__);
-			SendMessage(GetDlgItem(Dialog, IDC_BUILDTIME), WM_SETTEXT, 0, (LPARAM)buf);
+			SetDlgItemTextA(Dialog, IDC_BUILDTIME, buf);
 
 			// static text \x82̃T\x83C\x83Y\x82\xF0\x95ύX (2007.4.16 maya)
 			hwnd = GetDlgItem(Dialog, IDC_AUTHOR_URL);
 			hdc = GetDC(hwnd);
-			GetDlgItemText(Dialog, IDC_AUTHOR_URL, uimsg, sizeof(uimsg));
-			dwExt = GetTabbedTextExtent(hdc,uimsg,strlen(uimsg),0,NULL);
+			GetDlgItemTextA(Dialog, IDC_AUTHOR_URL, uimsg, sizeof(uimsg));
+			dwExt = GetTabbedTextExtentA(hdc,uimsg,strlen(uimsg),0,NULL);
 			w = LOWORD(dwExt) + 5; // \x95\x9D\x82\xAA\x8E኱\x91\xAB\x82\xE8\x82Ȃ\xA2\x82̂ŕ␳
 			h = HIWORD(dwExt);
 			GetWindowRect(hwnd, &r);
@@ -2246,8 +2253,8 @@
 
 			hwnd = GetDlgItem(Dialog, IDC_FORUM_URL);
 			hdc = GetDC(hwnd);
-			GetDlgItemText(Dialog, IDC_FORUM_URL, uimsg, sizeof(uimsg));
-			dwExt = GetTabbedTextExtent(hdc,uimsg,strlen(uimsg),0,NULL);
+			GetDlgItemTextA(Dialog, IDC_FORUM_URL, uimsg, sizeof(uimsg));
+			dwExt = GetTabbedTextExtentA(hdc,uimsg,strlen(uimsg),0,NULL);
 			w = LOWORD(dwExt) + 5; // \x95\x9D\x82\xAA\x8E኱\x91\xAB\x82\xE8\x82Ȃ\xA2\x82̂ŕ␳
 			h = HIWORD(dwExt);
 			GetWindowRect(hwnd, &r);
@@ -2456,8 +2463,8 @@
 	return FALSE;
 }
 
-static const TCHAR *LangList[] = {"English","Japanese","Russian","Korean","UTF-8",NULL};
-static TCHAR **LangUIList = NULL;
+static const char *LangList[] = {"English","Japanese","Russian","Korean","UTF-8",NULL};
+static char **LangUIList = NULL;
 #define LANG_PATH "lang"
 #define LANG_EXT ".lng"
 
@@ -2467,7 +2474,7 @@
 	int    file_num;
 	char   fullpath[1024];
 	HANDLE hFind;
-	WIN32_FIND_DATA fd;
+	WIN32_FIND_DATAA fd;
 	char **p;
 
 	_snprintf_s(fullpath, sizeof(fullpath), _TRUNCATE, "%s\\%s\\*%s", HomeDir, LANG_PATH, LANG_EXT);
@@ -2484,13 +2491,13 @@
 	}
 
 	file_num = 0;
-	hFind = FindFirstFile(fullpath,&fd);
+	hFind = FindFirstFileA(fullpath,&fd);
 	if (hFind != INVALID_HANDLE_VALUE) {
 		do {
 			if (!(fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) {
 				file_num++;
 			}
-		} while(FindNextFile(hFind,&fd));
+		} while(FindNextFileA(hFind,&fd));
 		FindClose(hFind);
 	}
 
@@ -2498,13 +2505,13 @@
 	LangUIList = calloc(file_num, sizeof(char *));
 
 	i = 0;
-	hFind = FindFirstFile(fullpath,&fd);
+	hFind = FindFirstFileA(fullpath,&fd);
 	if (hFind != INVALID_HANDLE_VALUE) {
 		do {
 			if (!(fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) {
 				LangUIList[i++] = _strdup(fd.cFileName);
 			}
-		} while(FindNextFile(hFind,&fd) && i < file_num);
+		} while(FindNextFileA(hFind,&fd) && i < file_num);
 		FindClose(hFind);
 	}
 	LangUIList[i] = NULL;
@@ -2555,11 +2562,11 @@
 
 			SetDlgTexts(Dialog, TextInfos, _countof(TextInfos), UILanguageFile);
 		
-			SendDlgItemMessage(Dialog, IDC_GENPORT, CB_ADDSTRING,
+			SendDlgItemMessageA(Dialog, IDC_GENPORT, CB_ADDSTRING,
 			                   0, (LPARAM)"TCP/IP");
 			for (w=1;w<=ts->MaxComPort;w++) {
 				_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) {
@@ -2583,7 +2590,7 @@
 			// \x8Dŏ\x89\x82Ɏw\x92肳\x82\xEA\x82Ă\xA2\x82錾\x8C\xEA\x83t\x83@\x83C\x83\x8B\x82̔ԍ\x86\x82\xF0\x8Ao\x82\xA6\x82Ă\xA8\x82\xAD\x81B
 			uilist_count = make_sel_lang_ui(ts->HomeDir);
 			langui_sel = get_sel_lang_ui(LangUIList, ts->UILanguageFile_ini);
-			SetDropDownList(Dialog, IDC_GENLANG_UI, ((const TCHAR **)LangUIList), langui_sel);
+			SetDropDownList(Dialog, IDC_GENLANG_UI, ((const char **)LangUIList), langui_sel);
 			if (LangUIList[0] == NULL) {
 				EnableWindow(GetDlgItem(Dialog, IDC_GENLANG_UI), FALSE);
 			}
@@ -2628,10 +2635,10 @@
 							_snprintf_s(ts->UILanguageFile_ini, sizeof(ts->UILanguageFile_ini), _TRUNCATE,
 								"%s\\%s", LANG_PATH, LangUIList[w - 1]);
 
-							GetCurrentDirectory(sizeof(CurDir), CurDir);
-							SetCurrentDirectory(ts->HomeDir);
+							GetCurrentDirectoryA(sizeof(CurDir), CurDir);
+							SetCurrentDirectoryA(ts->HomeDir);
 							_fullpath(ts->UILanguageFile, ts->UILanguageFile_ini, sizeof(ts->UILanguageFile));
-							SetCurrentDirectory(CurDir);
+							SetCurrentDirectoryA(CurDir);
 
 							// \x83^\x83C\x83g\x83\x8B\x82̍X\x90V\x82\xF0\x8Ds\x82\xA4\x81B(2014.2.23 yutaka)
 							PostMessage(GetParent(Dialog),WM_USER_CHANGETITLE,0,0);
@@ -2823,13 +2830,13 @@
 		{
 			static LPCHOOSEFONT cf;
 			PTTSet ts;
-			char uimsg[MAX_UIMSG];
+			TCHAR uimsg[MAX_UIMSG];
 
 			//EnableWindow(GetDlgItem(Dialog, cmb2), FALSE);
 			cf = (LPCHOOSEFONT)lParam;
 			ts = (PTTSet)cf->lCustData;
-			get_lang_msg("DLG_CHOOSEFONT_STC6", uimsg, sizeof(uimsg),
-			             "\"Font style\" selection here won't affect actual font appearance.", ts->UILanguageFile);
+			get_lang_msgT("DLG_CHOOSEFONT_STC6", uimsg, _countof(uimsg),
+			             _T("\"Font style\" selection here won't affect actual font appearance."), ts->UILanguageFile);
 			SetDlgItemText(Dialog, stc6, uimsg);
 
 			SetFocus(GetDlgItem(Dialog,cmb1));
@@ -2861,9 +2868,9 @@
 #ifndef CF_INACTIVEFONTS
 #define CF_INACTIVEFONTS 0x02000000L
 #endif
-DllExport BOOL WINAPI _ChooseFontDlg(HWND WndParent, LPLOGFONT LogFont, PTTSet ts)
+DllExport BOOL WINAPI _ChooseFontDlg(HWND WndParent, LPLOGFONTA LogFont, PTTSet ts)
 {
-	CHOOSEFONT cf;
+	CHOOSEFONTA cf;
 	BOOL Ok;
 
 	memset(&cf, 0, sizeof(CHOOSEFONT));
@@ -2880,7 +2887,7 @@
 	cf.nFontType = REGULAR_FONTTYPE;
 	cf.hInstance = hInst;
 	cf.lCustData = (LPARAM)ts;
-	Ok = ChooseFont(&cf);
+	Ok = ChooseFontA(&cf);
 	return Ok;
 }
 

Modified: branches/cmake/teraterm/ttpdlg/ttdlg.h
===================================================================
--- branches/cmake/teraterm/ttpdlg/ttdlg.h	2018-11-17 15:43:03 UTC (rev 7262)
+++ branches/cmake/teraterm/ttpdlg/ttdlg.h	2018-11-17 15:43:21 UTC (rev 7263)
@@ -9,7 +9,7 @@
 BOOL WINAPI _GetHostName(HWND WndParent, PGetHNRec GetHNRec);
 BOOL WINAPI _ChangeDirectory(HWND WndParent, PCHAR CurDir);
 BOOL WINAPI _AboutDialog(HWND WndParent);
-BOOL WINAPI _ChooseFontDlg(HWND WndParent, LPLOGFONT LogFont, PTTSet ts);
+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);

Modified: branches/cmake/teraterm/ttpdlg/ttpdlg.rc
===================================================================
--- branches/cmake/teraterm/ttpdlg/ttpdlg.rc	2018-11-17 15:43:03 UTC (rev 7262)
+++ branches/cmake/teraterm/ttpdlg/ttpdlg.rc	2018-11-17 15:43:21 UTC (rev 7263)
@@ -239,7 +239,7 @@
     CONTROL         "(C) 2004-2018 TeraTerm Project",IDC_PROJECT_LABEL,
                     "Static",SS_LEFTNOWORDWRAP | WS_GROUP,39,67,122,9
     LTEXT           "Includes:",IDC_INLUCDE_LABEL,39,26,31,8
-    LTEXT           "Version",IDC_TT_VERSION,39,12,101,8
+    LTEXT           "Version",IDC_TT_VERSION,39,12,127,8
     RTEXT           "Author:",IDC_AUTHOR_LABEL,5,106,28,8
     LTEXT           "https://ttssh2.osdn.jp/",IDC_AUTHOR_URL,36,106,128,8,SS_NOTIFY | WS_TABSTOP
     RTEXT           "Forum:",IDC_FORUM_LABEL,5,115,25,8
@@ -454,7 +454,7 @@
 //
 // Generated from the TEXTINCLUDE 3 resource.
 //
-//#include "ttpdlg-version.rc"
+#include "ttpdlg-version.rc"
 
 /////////////////////////////////////////////////////////////////////////////
 #endif    // not APSTUDIO_INVOKED


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