[Ttssh2-commit] [7525] その他の設定ダイアログを高DPI化

Back to archive index
scmno****@osdn***** scmno****@osdn*****
2019年 3月 29日 (金) 01:38:17 JST


Revision: 7525
          http://sourceforge.jp/projects/ttssh2/scm/svn/commits/7525
Author:   zmatsuo
Date:     2019-03-29 01:38:16 +0900 (Fri, 29 Mar 2019)
Log Message:
-----------
その他の設定ダイアログを高DPI化

Modified Paths:
--------------
    trunk/teraterm/teraterm/CMakeLists.txt
    trunk/teraterm/teraterm/addsetting.cpp
    trunk/teraterm/teraterm/addsetting.h
    trunk/teraterm/teraterm/vtwin.cpp

Added Paths:
-----------
    trunk/teraterm/common/tmfc.cpp
    trunk/teraterm/common/tmfc.h
    trunk/teraterm/common/tmfc_frame.cpp

-------------- next part --------------
Added: trunk/teraterm/common/tmfc.cpp
===================================================================
--- trunk/teraterm/common/tmfc.cpp	                        (rev 0)
+++ trunk/teraterm/common/tmfc.cpp	2019-03-28 16:38:16 UTC (rev 7525)
@@ -0,0 +1,807 @@
+/*
+ * Copyright (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.
+ */
+
+/*
+ * Tera term Micro Framework class
+ */
+#include "tmfc.h"
+
+#include <windowsx.h>
+#include <assert.h>
+#include <tchar.h>
+#include "dlglib.h"
+#include "ttlib.h"
+
+// \x83e\x83\x93\x83v\x83\x8C\x81[\x83g\x82̏\x91\x82\xAB\x8A\xB7\x82\xA6\x82\xF0\x8Ds\x82\xA4
+#define REWRITE_TEMPLATE
+
+#if (defined(_MSC_VER) && (_MSC_VER <= 1500)) || \
+	(__cplusplus <= 199711L)
+#define nullptr NULL	// C++11,nullptr / > VS2010
+#endif
+
+TTCWnd::TTCWnd()
+{
+	m_hWnd = nullptr;
+	m_hInst = nullptr;
+	m_hAccel = nullptr;
+	m_hParentWnd = nullptr;
+}
+
+LRESULT TTCWnd::SendMessage(UINT msg, WPARAM wp, LPARAM lp)
+{
+	return ::SendMessage(m_hWnd, msg, wp, lp);
+}
+
+HWND TTCWnd::GetDlgItem(int id)
+{
+	return ::GetDlgItem(m_hWnd, id);
+}
+
+LRESULT TTCWnd::SendDlgItemMessageT(int id, UINT msg, WPARAM wp, LPARAM lp)
+{
+	return ::SendDlgItemMessage(m_hWnd, id, msg, wp, lp);
+}
+
+#if defined(UNICODE)
+LRESULT TTCWnd::SendDlgItemMessageW(int id, UINT msg, WPARAM wp, LPARAM lp)
+{
+	return ::SendDlgItemMessageW(m_hWnd, id, msg, wp, lp);
+}
+#endif
+
+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);
+}
+
+#if defined(UNICODE)
+void TTCWnd::GetDlgItemTextW(int id, wchar_t *buf, size_t size)
+{
+	::GetDlgItemTextW(m_hWnd, id, buf, (int)size);
+}
+#endif
+
+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);
+}
+
+#if defined(UNICODE)
+void TTCWnd::SetDlgItemTextW(int id, const wchar_t *str)
+{
+	::SetDlgItemTextW(m_hWnd, id, str);
+}
+#endif
+
+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)
+{
+	::SendMessage(GetDlgItem(id), BM_SETCHECK, nCheck, 0);
+}
+
+UINT TTCWnd::GetCheck(int id)
+{
+	return ::IsDlgButtonChecked(m_hWnd, id);
+}
+
+void TTCWnd::SetCurSel(int id, int no)
+{
+	HWND hWnd = GetDlgItem(id);
+	assert(hWnd != 0);
+	TCHAR ClassName[32];
+	int r = GetClassName(hWnd, ClassName, _countof(ClassName));
+	assert(r != 0); (void)r;
+	UINT msg =
+		(_tcscmp(ClassName, _T("ListBox")) == 0) ? LB_SETCURSEL :
+		(_tcscmp(ClassName, _T("ComboBox")) == 0) ? CB_SETCURSEL : 0;
+	assert(msg != 0);
+	::SendMessage(hWnd, msg, no, 0);
+}
+
+int TTCWnd::GetCurSel(int id)
+{
+	HWND hWnd = GetDlgItem(id);
+	assert(hWnd != 0);
+	TCHAR ClassName[32];
+	int r = GetClassName(hWnd, ClassName, _countof(ClassName));
+	assert(r != 0); (void)r;
+	UINT msg =
+		(_tcscmp(ClassName, _T("ListBox")) == 0) ? LB_GETCURSEL :
+		(_tcscmp(ClassName, _T("ComboBox")) == 0) ? CB_GETCURSEL : 0;
+	assert(msg != 0);
+	LRESULT lResult = ::SendMessage(hWnd, msg, 0, 0);
+	return (int)lResult;
+}
+
+void TTCWnd::EnableDlgItem(int id, BOOL enable)
+{
+	::EnableWindow(GetDlgItem(id), enable);
+}
+
+void TTCWnd::SetDlgItemInt(int id, UINT val, BOOL bSigned)
+{
+	::SetDlgItemInt(m_hWnd, id, val, bSigned);
+}
+
+UINT TTCWnd::GetDlgItemInt(int id, BOOL* lpTrans, BOOL bSigned) const
+{
+	return ::GetDlgItemInt(m_hWnd, id, lpTrans, bSigned);
+}
+
+void TTCWnd::ShowWindow(int nCmdShow)
+{
+	::ShowWindow(m_hWnd, nCmdShow);
+}
+
+void TTCWnd::SetWindowTextT(const TCHAR *str)
+{
+	::SetWindowText(m_hWnd, str);
+}
+
+#if defined(UNICODE)
+void TTCWnd::SetWindowTextW(const wchar_t *str)
+{
+	::SetWindowTextW(m_hWnd, str);
+}
+#endif
+
+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);
+}
+
+LONG_PTR TTCWnd::GetWindowLongPtr(int nIndex)
+{
+	return ::GetWindowLongPtr(m_hWnd, nIndex);
+}
+
+void TTCWnd::ModifyStyleCom(int nStyleOffset,
+							DWORD dwRemove, DWORD dwAdd, UINT nFlags)
+{
+	const LONG_PTR dwStyle = GetWindowLongPtr(nStyleOffset);
+	const LONG_PTR add = dwAdd;
+	const LONG_PTR remove = dwRemove;
+	const LONG_PTR dwNewStyle = (dwStyle & ~remove) | add;
+	if (dwStyle != dwNewStyle) {
+		SetWindowLongPtr(nStyleOffset, dwNewStyle);
+	}
+	if (nFlags != 0)
+	{
+		SetWindowPos(nullptr, 0, 0, 0, 0,
+					 SWP_NOSIZE | SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE | nFlags);
+	}
+}
+
+void TTCWnd::ModifyStyle(DWORD dwRemove, DWORD dwAdd, UINT nFlags)
+{
+	ModifyStyleCom(GWL_STYLE, dwRemove, dwAdd, nFlags);
+}
+
+void TTCWnd::ModifyStyleEx(DWORD dwRemove, DWORD dwAdd, UINT nFlags)
+{
+	ModifyStyleCom(GWL_EXSTYLE, dwRemove, dwAdd, nFlags);
+}
+
+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);
+}
+
+#if defined(UNICODE)
+int TTCWnd::MessageBoxW(const wchar_t *lpText, const wchar_t *lpCaption, UINT uType)
+{
+	return ::MessageBoxW(m_hWnd, lpText, lpCaption, uType);
+}
+#endif
+
+BOOL TTCWnd::GetWindowRect(RECT *R)
+{
+	return ::GetWindowRect(m_hWnd, R);
+}
+
+BOOL TTCWnd::SetWindowPos(HWND hWndInsertAfter, int X, int Y, int cx, int cy, UINT uFlags)
+{
+	return ::SetWindowPos(m_hWnd, hWndInsertAfter, X, Y, cx, cy, uFlags);
+}
+
+BOOL TTCWnd::GetClientRect(RECT *R)
+{
+	return ::GetClientRect(m_hWnd, R);
+}
+
+BOOL TTCWnd::InvalidateRect(RECT *R, BOOL bErase)
+{
+	return ::InvalidateRect(m_hWnd, R, bErase);
+}
+
+BOOL TTCWnd::EndDialog(int nResult)
+{
+	return ::EndDialog(m_hWnd, nResult);
+}
+
+void TTCWnd::DestroyWindow()
+{
+	::DestroyWindow(m_hWnd);
+}
+
+HDC TTCWnd::BeginPaint(LPPAINTSTRUCT lpPaint)
+{
+	return ::BeginPaint(m_hWnd, lpPaint);
+}
+
+BOOL TTCWnd::EndPaint(LPPAINTSTRUCT lpPaint)
+{
+	return ::EndPaint(m_hWnd, lpPaint);
+}
+
+LRESULT TTCWnd::DefWindowProc(UINT msg, WPARAM wParam, LPARAM lParam)
+{
+	return ::DefWindowProc(m_hWnd, msg, wParam, lParam);
+}
+
+////////////////////////////////////////
+
+TTCDialog *TTCDialog::pseudoPtr;
+
+TTCDialog::TTCDialog()
+{
+}
+
+TTCDialog::~TTCDialog()
+{
+}
+
+/**
+ * \x83_\x83C\x83A\x83\x8D\x83O\x8F\x89\x8A\xFA\x89\xBB
+ * @retval	TRUE	\x8F\x88\x97\x9D\x82\xAA\x8Ds\x82\xED\x82ꂽ(\x8E\x9F\x82̃\x81\x83b\x83Z\x81[\x83W\x8F\x88\x97\x9D\x82͌Ăяo\x82\xB3\x82\xEA\x82Ȃ\xA2)
+ * @retval	FALSE	\x8E\x9F\x82̃\x81\x83b\x83Z\x81[\x83W\x8F\x88\x97\x9D\x82͌Ăяo\x82\xB3\x82\xEA\x82\xE9
+ *
+ * \x8E\x9F\x82̃\x81\x83b\x83Z\x81[\x83W\x8F\x88\x97\x9D
+ *		TTCDialog::DlgProc(msg=WM_INITDIALOG)
+ */
+BOOL TTCDialog::OnInitDialog()
+{
+	return FALSE;
+}
+
+/**
+ * OK\x83{\x83^\x83\x93
+ * @retval	TRUE	\x8F\x88\x97\x9D\x82\xAA\x8Ds\x82\xED\x82ꂽ(\x8E\x9F\x82̃\x81\x83b\x83Z\x81[\x83W\x8F\x88\x97\x9D\x82͌Ăяo\x82\xB3\x82\xEA\x82Ȃ\xA2)
+ * @retval	FALSE	\x8E\x9F\x82̃\x81\x83b\x83Z\x81[\x83W\x8F\x88\x97\x9D\x82͌Ăяo\x82\xB3\x82\xEA\x82\xE9
+ *
+ * \x8E\x9F\x82̃\x81\x83b\x83Z\x81[\x83W\x8F\x88\x97\x9D
+ *		TTCDialog::OnCommand()
+ */
+BOOL TTCDialog::OnOK()
+{
+	EndDialog(IDOK);
+	return TRUE;
+}
+
+/**
+ * CANCEL\x83{\x83^\x83\x93
+ * @retval	TRUE	\x8F\x88\x97\x9D\x82\xAA\x8Ds\x82\xED\x82ꂽ(\x8E\x9F\x82̃\x81\x83b\x83Z\x81[\x83W\x8F\x88\x97\x9D\x82͌Ăяo\x82\xB3\x82\xEA\x82Ȃ\xA2)
+ * @retval	FALSE	\x8E\x9F\x82̃\x81\x83b\x83Z\x81[\x83W\x8F\x88\x97\x9D\x82͌Ăяo\x82\xB3\x82\xEA\x82\xE9
+ *
+ * \x8E\x9F\x82̃\x81\x83b\x83Z\x81[\x83W\x8F\x88\x97\x9D
+ *		TTCDialog::OnCommand()
+ */
+BOOL TTCDialog::OnCancel()
+{
+	EndDialog(IDCANCEL);
+	return TRUE;
+}
+
+BOOL TTCDialog::OnCommand(WPARAM wp, LPARAM lp)
+{
+	return FALSE;
+}
+
+/**
+ * WM_CLOSE\x83\x81\x83b\x83Z\x81[\x83W\x8F\x88\x97\x9D
+ * @retval	TRUE	\x8F\x88\x97\x9D\x82\xAA\x8Ds\x82\xED\x82ꂽ(\x8E\x9F\x82̃\x81\x83b\x83Z\x81[\x83W\x8F\x88\x97\x9D\x82͌Ăяo\x82\xB3\x82\xEA\x82Ȃ\xA2)
+ * @retval	FALSE	\x8E\x9F\x82̃\x81\x83b\x83Z\x81[\x83W\x8F\x88\x97\x9D\x82͌Ăяo\x82\xB3\x82\xEA\x82\xE9
+ *
+ * \x8E\x9F\x82̃\x81\x83b\x83Z\x81[\x83W\x8F\x88\x97\x9D
+ *		TTCDialog::OnCancel()
+ */
+BOOL TTCDialog::OnClose()
+{
+	return FALSE;
+}
+
+/**
+ * WM_NCDESTROY\x83\x81\x83b\x83Z\x81[\x83W\x8F\x88\x97\x9D
+ * @retval	TRUE	\x8F\x88\x97\x9D\x82\xAA\x8Ds\x82\xED\x82ꂽ(\x8E\x9F\x82̃\x81\x83b\x83Z\x81[\x83W\x8F\x88\x97\x9D\x82͌Ăяo\x82\xB3\x82\xEA\x82Ȃ\xA2)
+ * @retval	FALSE	\x8E\x9F\x82̃\x81\x83b\x83Z\x81[\x83W\x8F\x88\x97\x9D\x82͌Ăяo\x82\xB3\x82\xEA\x82\xE9
+ *
+ * \x8E\x9F\x82̃\x81\x83b\x83Z\x81[\x83W\x8F\x88\x97\x9D
+ *		TTCDialog::DlgProc()
+ */
+BOOL TTCDialog::PostNcDestroy()
+{
+	return FALSE;
+}
+
+/*
+ * @retval	TRUE	\x83\x81\x83b\x83Z\x81[\x83W\x82\xF0\x8F\x88\x97\x9D\x82\xB5\x82\xBD\x8E\x9E
+ * @retval	FALSE	\x83\x81\x83b\x83Z\x81[\x83W\x82\xF0\x8F\x88\x97\x9D\x82\xB5\x82Ȃ\xA9\x82\xC1\x82\xBD\x8E\x9E
+ * @retval	\x82\xBB\x82̑\xBC	\x83\x81\x83b\x83Z\x81[\x83W\x82ɂ\xE6\x82\xC1\x82ĈقȂ邱\x82Ƃ\xAA\x82\xA0\x82\xE9
+ */
+LRESULT TTCDialog::DlgProc(UINT msg, WPARAM wp, LPARAM lp)
+{
+	(void)msg;
+	(void)wp;
+	(void)lp;
+	return (LRESULT)FALSE;
+}
+
+/*
+ * @retval	TRUE	\x83\x81\x83b\x83Z\x81[\x83W\x82\xF0\x8F\x88\x97\x9D\x82\xB5\x82\xBD\x8E\x9E
+ * @retval	FALSE	\x83\x81\x83b\x83Z\x81[\x83W\x82\xF0\x8F\x88\x97\x9D\x82\xB5\x82Ȃ\xA9\x82\xC1\x82\xBD\x8E\x9E
+ */
+LRESULT TTCDialog::DlgProcBase(UINT msg, WPARAM wp, LPARAM lp)
+{
+	BOOL Processed = FALSE;
+	switch (msg) {
+	case WM_INITDIALOG:
+		Processed = OnInitDialog();
+		break;
+	case WM_COMMAND:
+	{
+		const WORD wID = GET_WM_COMMAND_ID(wp, lp);
+		switch (wID) {
+		case IDOK:
+			Processed = OnOK();
+			//self->DestroyWindow();
+			//SetWindowLongPtr(hwndDlg, DWL_MSGRESULT, lResult)
+			// return TRUE
+			break;
+		case IDCANCEL:
+			Processed = OnCancel();
+			break;
+		}
+
+		if (Processed == FALSE) {
+			Processed = OnCommand(wp, lp);
+		}
+		break;
+	}
+	case WM_NCDESTROY:
+		Processed = PostNcDestroy();
+		break;
+	case WM_CLOSE:
+		// CLOSE\x83{\x83^\x83\x93\x82\xF0\x89\x9F\x82\xB5\x82\xBD\x8E\x9E\x81A
+		Processed = OnClose();
+		if (Processed == FALSE) {
+			//	\x83I\x81[\x83o\x81[\x83\x89\x83C\x83h\x82\xB3\x82\xEA\x82Ă\xA2\x82Ȃ\xAF\x82\xEA\x82\xCE
+			//	dialog\x82Ȃ\xE7OnCancel()\x82\xAA\x94\xAD\x90\xB6\x82\xB7\x82\xE9
+			Processed = OnCancel();
+		}
+		break;
+	default:
+		Processed = FALSE;
+		break;
+	}
+
+	if (Processed == TRUE) {
+		// \x8F\x88\x97\x9D\x82\xB5\x82\xBD
+		return TRUE;
+	}
+
+	// \x8DŌ\xE3\x82̃\x81\x83b\x83Z\x81[\x83W\x8F\x88\x97\x9D
+	return DlgProc(msg, wp, lp);
+}
+
+LRESULT TTCDialog::WndProcBase(UINT msg, WPARAM wp, LPARAM lp)
+{
+	BOOL Processed = FALSE;
+	switch (msg) {
+	case WM_INITDIALOG:
+		Processed = OnInitDialog();
+		break;
+	case WM_COMMAND:
+	{
+		const WORD wID = GET_WM_COMMAND_ID(wp, lp);
+		switch (wID) {
+		case IDOK:
+			Processed = OnOK();
+			//self->DestroyWindow();
+			//SetWindowLongPtr(hwndDlg, DWL_MSGRESULT, lResult)
+			// return TRUE
+			break;
+		case IDCANCEL:
+			Processed = OnCancel();
+			break;
+		}
+
+		if (Processed == FALSE) {
+			Processed = OnCommand(wp, lp);
+		}
+		break;
+	}
+	case WM_NCDESTROY:
+		Processed = PostNcDestroy();
+		break;
+	case WM_CLOSE:
+		// CLOSE\x83{\x83^\x83\x93\x82\xF0\x89\x9F\x82\xB5\x82\xBD\x8E\x9E\x81A
+		Processed = OnClose();
+		if (Processed == FALSE) {
+			//	\x83I\x81[\x83o\x81[\x83\x89\x83C\x83h\x82\xB3\x82\xEA\x82Ă\xA2\x82Ȃ\xAF\x82\xEA\x82\xCE
+			//	dialog\x82Ȃ\xE7OnCancel()\x82\xAA\x94\xAD\x90\xB6\x82\xB7\x82\xE9
+			Processed = OnCancel();
+		}
+		break;
+	default:
+		Processed = FALSE;
+		break;
+	}
+
+	if (Processed == TRUE) {
+		// \x8F\x88\x97\x9D\x82\xB5\x82\xBD
+		return TRUE;
+	}
+
+	// DlgProc\x82\xF0\x83I\x81[\x83o\x83\x89\x83C\x83h\x82\xB7\x82\xE9\x82̂ł͂Ȃ\xAD\x81A
+	// DefWindowProc\x82\xF0\x83I\x81[\x83o\x81[\x83\x89\x83C\x83h\x82\xB7\x82邱\x82\xC6
+	return DefWindowProc(msg, wp, lp);
+}
+
+/**
+ * for modal dialog
+ */
+INT_PTR TTCDialog::DoModal(HINSTANCE hInstance, HWND hParent, int idd)
+{
+	pseudoPtr = this;
+#if defined(REWRITE_TEMPLATE)
+	INT_PTR result =
+		TTDialogBoxParam(hInstance,
+						 MAKEINTRESOURCE(idd),
+						 hParent,
+						 (DLGPROC)&DlgProcStub, (LPARAM)this);
+#else
+	INT_PTR result =
+		DialogBoxParam(hInstance,
+					   MAKEINTRESOURCE(idd),
+					   hParent,
+					   (DLGPROC)&DlgProcStub, (LPARAM)this);
+#endif
+	pseudoPtr = nullptr;
+	return result;
+}
+
+/**
+ * for modeless dialog
+ */
+BOOL TTCDialog::Create(HINSTANCE hInstance, HWND hParent, int idd)
+{
+	m_hInst = hInstance;
+	m_hParentWnd = hParent;
+#if defined(REWRITE_TEMPLATE)
+	DLGTEMPLATE *lpTemplate = TTGetDlgTemplate(hInstance, MAKEINTRESOURCE(idd));
+#else
+	HRSRC hResource = ::FindResource(hInstance, MAKEINTRESOURCE(idd), RT_DIALOG);
+	HANDLE hDlgTemplate = ::LoadResource(hInstance, hResource);
+	DLGTEMPLATE *lpTemplate = (DLGTEMPLATE *)::LockResource(hDlgTemplate);
+#endif
+	DLGPROC dlgproc = (DLGPROC)DlgProcStub;
+	const wchar_t *dialog_class = TTGetClassName(lpTemplate);
+	if (dialog_class != nullptr) {
+		// Modaless Dialog & Dialog application
+		//  WNDCLASS.lpfnWndProc = TTCDialog::WndProcBase
+		dlgproc = nullptr;
+	}
+	pseudoPtr = this;
+	HWND hWnd = ::CreateDialogIndirectParam(
+		hInstance, lpTemplate, hParent,
+		dlgproc, (LPARAM)this);
+	pseudoPtr = nullptr;
+	if (hWnd == nullptr)
+	{
+#if defined(_DEBUG)
+		DWORD e = GetLastError();
+#endif
+		assert(false);
+		return FALSE;
+	}
+
+	m_hParentWnd = hParent;
+	m_hWnd = hWnd;
+	m_hInst = hInstance;
+//	::EnableWindow(hParent,FALSE);
+//	::ShowWindow(hWnd, SW_SHOW);		// TODO \x8AO\x82ł\xE2\x82\xE9\x82̂\xAA\x97ǂ\xB3\x82\xBB\x82\xA4
+//	::EnableWindow(m_hWnd,TRUE);
+
+	return TRUE;
+}
+
+/*
+ * @retval	TRUE	\x83\x81\x83b\x83Z\x81[\x83W\x82\xF0\x8F\x88\x97\x9D\x82\xB5\x82\xBD\x8E\x9E
+ * @retval	FALSE	\x83\x81\x83b\x83Z\x81[\x83W\x82\xF0\x8F\x88\x97\x9D\x82\xB5\x82Ȃ\xA9\x82\xC1\x82\xBD\x8E\x9E
+ */
+LRESULT CALLBACK TTCDialog::DlgProcStub(HWND hWnd, UINT msg, WPARAM wp, LPARAM lp)
+{
+	TTCDialog *self = (TTCDialog *)::GetWindowLongPtr(hWnd, DWLP_USER);
+	if (self == nullptr) {
+		self = pseudoPtr;
+		self->m_hWnd = hWnd;
+		if (msg == WM_INITDIALOG) {
+			::SetWindowLongPtr(hWnd, DWLP_USER, (LONG_PTR)self);
+			pseudoPtr = nullptr;
+		}
+	}
+	assert(self != nullptr);
+
+	LRESULT result = self->DlgProcBase(msg, wp, lp);
+	return result;
+}
+
+/*
+ * @retval	TRUE	\x83\x81\x83b\x83Z\x81[\x83W\x82\xF0\x8F\x88\x97\x9D\x82\xB5\x82\xBD\x8E\x9E
+ * @retval	FALSE	\x83\x81\x83b\x83Z\x81[\x83W\x82\xF0\x8F\x88\x97\x9D\x82\xB5\x82Ȃ\xA9\x82\xC1\x82\xBD\x8E\x9E
+ */
+LRESULT CALLBACK TTCDialog::WndProcStub(HWND hWnd, UINT msg, WPARAM wp, LPARAM lp)
+{
+	TTCDialog *self = (TTCDialog *)::GetWindowLongPtr(hWnd, GWLP_USERDATA);
+	if (self == nullptr) {
+		assert(pseudoPtr != nullptr);
+		self = pseudoPtr;
+		self->m_hWnd = hWnd;
+		if (msg == WM_CREATE) {
+			::SetWindowLongPtr(hWnd, GWLP_USERDATA, (LONG_PTR)self);
+			pseudoPtr = nullptr;
+		}
+	}
+	assert(self != nullptr);
+
+	return self->WndProcBase(msg, wp, lp);
+}
+
+void TTCDialog::DestroyWindow()
+{
+	if (m_hWnd != nullptr) {
+		::EnableWindow(m_hParentWnd,TRUE);
+		::SetFocus(m_hParentWnd);
+		::DestroyWindow(m_hWnd);
+		m_hWnd = nullptr;
+	}
+}
+
+////////////////////////////////////////
+
+// quick hack :-(
+static HINSTANCE ghInstance;
+static class TTCPropertySheet *gTTCPS;
+
+TTCPropertyPage::TTCPropertyPage(HINSTANCE inst, int id, TTCPropertySheet *sheet)
+{
+	memset(&m_psp, 0, sizeof(m_psp));
+	m_psp.dwSize = sizeof(m_psp);
+	m_psp.dwFlags = PSP_DEFAULT;
+	m_psp.hInstance = inst;
+	m_psp.pszTemplate = MAKEINTRESOURCE(id);
+#if defined(REWRITE_TEMPLATE)
+	m_psp.dwFlags |= PSP_DLGINDIRECT;
+	m_psp.pResource = TTGetDlgTemplate(inst, m_psp.pszTemplate);
+#endif
+//	m_psp.pfnDlgProc = (DLGPROC)Proc;
+	m_psp.pfnDlgProc = Proc;
+	m_psp.lParam = (LPARAM)this;
+
+	m_pSheet = sheet;
+}
+
+TTCPropertyPage::~TTCPropertyPage()
+{
+	free((void *)m_psp.pResource);
+}
+
+void TTCPropertyPage::OnInitDialog()
+{
+}
+
+void TTCPropertyPage::OnOK()
+{
+}
+
+BOOL TTCPropertyPage::OnCommand(WPARAM wp, LPARAM lp)
+{
+	return TRUE;
+}
+
+HBRUSH TTCPropertyPage::OnCtlColor(HDC hDC, HWND hWnd)
+{
+	return (HBRUSH)::DefWindowProc(m_hWnd, WM_CTLCOLORSTATIC, (WPARAM)hDC, (LPARAM)hWnd);
+}
+
+UINT CALLBACK TTCPropertyPage::PropSheetPageProc(HWND hwnd, UINT uMsg, LPPROPSHEETPAGE ppsp)
+{
+	return 0;
+}
+
+INT_PTR CALLBACK TTCPropertyPage::Proc(HWND hDlgWnd, UINT msg, WPARAM wp, LPARAM lp)
+{
+	TTCPropertyPage *self = (TTCPropertyPage *)::GetWindowLongPtr(hDlgWnd, DWLP_USER);
+	switch (msg)
+	{
+	case WM_INITDIALOG:
+		self = (TTCPropertyPage *)(((PROPSHEETPAGE *)lp)->lParam);
+		::SetWindowLongPtr(hDlgWnd, DWLP_USER, (LONG_PTR)self);
+		self->m_hWnd = hDlgWnd;
+		self->OnInitDialog();
+		break;
+	case WM_NOTIFY:
+	{
+		NMHDR * nmhdr = (NMHDR *)lp;
+		switch (nmhdr->code)
+		{
+		case PSN_APPLY:
+			self->OnOK();
+			break;
+		default:
+			break;
+		}
+		break;
+	}
+	case WM_COMMAND:
+		self->OnCommand(wp, lp);
+		break;
+	case WM_CTLCOLORSTATIC:
+		return (INT_PTR)self->OnCtlColor((HDC)wp, (HWND)lp);
+	}
+	return FALSE;
+}
+
+////////////////////////////////////////
+
+TTCPropertySheet::TTCPropertySheet(HINSTANCE hInstance, LPCTSTR pszCaption, HWND hParentWnd)
+{
+	m_hInst = hInstance;
+	memset(&m_psh, 0, sizeof(m_psh));
+	m_psh.dwSize = sizeof(m_psh);
+	m_psh.dwFlags = PSH_DEFAULT | PSH_NOAPPLYNOW | PSH_USECALLBACK;	// | PSH_MODELESS
+	if (pszCaption != nullptr) {
+		m_psh.pszCaption = pszCaption;
+		//m_psh.dwFlags |= PSH_PROPTITLE;		// \x81u\x82̃v\x83\x8D\x83p\x83e\x83B\x81[\x81v\x82\xAA\x92lj\xC1\x82\xB3\x82\xEA\x82\xE9?
+	}
+	m_psh.hwndParent = hParentWnd;
+	m_psh.pfnCallback = PropSheetProc;
+}
+
+TTCPropertySheet::~TTCPropertySheet()
+{
+}
+
+INT_PTR TTCPropertySheet::DoModal()
+{
+	ghInstance = m_hInst;
+	gTTCPS = this;
+	return PropertySheet(&m_psh);
+
+	// \x83\x82\x81[\x83_\x83\x8C\x83X\x82ɂ\xB7\x82\xE9\x82ƃ^\x83u\x82̓\xAE\x82\xAB\x82\xAA\x82\xA8\x82\xA9\x82\xB5\x82\xA2
+#if 0
+	// \x83\x82\x81[\x83h\x83\x8C\x83X\x83_\x83C\x83A\x83\x8D\x83O\x83{\x83b\x83N\x83X\x82̏ꍇ\x82̓E\x83B\x83\x93\x83h\x83E\x82̃n\x83\x93\x83h\x83\x8B
+	m_hWnd = (HWND)::PropertySheet(&m_psh);
+//	ShowWindow(m_hWnd, SW_SHOW);
+
+//	::ModifyStyle(m_hWnd, TCS_MULTILINE, TCS_SINGLELINE, 0);
+
+	ModalResult = 0;
+	HWND hDlgWnd = m_hWnd;
+	for(;;) {
+		if (ModalResult != 0) {
+			break;
+		}
+		MSG Msg;
+		BOOL quit = !::GetMessage(&Msg, nullptr, nullptr, nullptr);
+		if (quit) {
+			// QM_QUIT
+			PostQuitMessage(0);
+			return IDCANCEL;
+		}
+		if ((hDlgWnd == Msg.hwnd) ||
+			::SendMessage(hDlgWnd, PSM_ISDIALOGMESSAGE, nullptr, (LPARAM)&Msg))
+		{
+			// \x83_\x83C\x83A\x83\x8D\x83O\x88ȊO\x82̏\x88\x97\x9D
+			::TranslateMessage(&Msg);
+			::DispatchMessage(&Msg);
+		}
+		if (!SendMessage(hDlgWnd, PSM_GETCURRENTPAGEHWND, 0, 0)) {
+			// \x83v\x83\x8D\x83p\x83e\x83B\x81[\x83V\x81[\x83g\x8FI\x97\xB9
+			break;
+		}
+	}
+	return ModalResult;
+#endif
+}
+
+int CALLBACK TTCPropertySheet::PropSheetProc(HWND hWnd, UINT msg, LPARAM lp)
+{
+	switch (msg) {
+	case PSCB_PRECREATE:
+	{
+#if defined(REWRITE_TEMPLATE)
+		// \x83e\x83\x93\x83v\x83\x8C\x81[\x83g\x82̓\xE0\x97e\x82\xF0\x8F\x91\x82\xAB\x8A\xB7\x82\xA6\x82\xE9 \x8A댯
+		// http://home.att.ne.jp/banana/akatsuki/doc/atlwtl/atlwtl15-01/index.html
+		size_t PrevTemplSize;
+		size_t NewTemplSize;
+		DLGTEMPLATE *NewTempl =
+			TTGetNewDlgTemplate(ghInstance, (DLGTEMPLATE *)lp,
+								&PrevTemplSize, &NewTemplSize);
+		NewTempl->style &= ~DS_CONTEXTHELP;		// check DLGTEMPLATEEX
+		memcpy((void *)lp, NewTempl, NewTemplSize);
+		free(NewTempl);
+#endif
+		break;
+	}
+	case PSCB_INITIALIZED:
+	{
+		//TTCPropertySheet *self = (TTCPropertySheet *)lp;
+		TTCPropertySheet *self = gTTCPS;
+		self->m_hWnd = hWnd;
+		self->OnInitDialog();
+		break;
+	}
+	}
+	return 0;
+}
+
+void TTCPropertySheet::OnInitDialog()
+{
+}

Added: trunk/teraterm/common/tmfc.h
===================================================================
--- trunk/teraterm/common/tmfc.h	                        (rev 0)
+++ trunk/teraterm/common/tmfc.h	2019-03-28 16:38:16 UTC (rev 7525)
@@ -0,0 +1,186 @@
+/*
+ * Copyright (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.
+ */
+
+/*
+ * Tera term Micro Framework class
+ */
+#pragma once
+#include <windows.h>
+
+class TTCWnd
+{
+public:
+	HWND m_hWnd;
+	HINSTANCE m_hInst;
+	HACCEL m_hAccel;
+	HWND m_hParentWnd;
+
+	TTCWnd();
+	void DestroyWindow();
+	HWND GetSafeHwnd() const {return m_hWnd;}
+	HWND GetSafeHwnd() { return m_hWnd; }
+	HDC BeginPaint(LPPAINTSTRUCT lpPaint);
+	BOOL EndPaint(LPPAINTSTRUCT lpPaint);
+	LRESULT SendMessage(UINT msg, WPARAM wp, LPARAM lp);
+	void ShowWindow(int nCmdShow);
+	void SetWindowTextT(const TCHAR *str);
+#if defined(UNICODE)
+	void SetWindowTextW(const wchar_t *str);
+#endif
+	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 MessageBoxT(LPCTSTR lpText, LPCTSTR lpCaption, UINT uType);
+	int MessageBoxA(const char * lpText, const char *lpCaption, UINT uType);
+#if defined(UNICODE)
+	int MessageBoxW(const wchar_t * lpText, const wchar_t *lpCaption, UINT uType);
+#endif
+	//virtual LRESULT DefWindowProc(UINT message, WPARAM wParam, LPARAM lParam);
+	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);
+	BOOL GetClientRect(RECT *R);
+	BOOL InvalidateRect(RECT *R, BOOL bErase = TRUE);
+	BOOL EndDialog(int nResult);
+	// for controls
+	HWND GetDlgItem(int id);
+	LRESULT SendDlgItemMessageT(int id, UINT msg, WPARAM wp, LPARAM lp);
+#if defined(UNICODE)
+	LRESULT SendDlgItemMessageW(int id, UINT msg, WPARAM wp, LPARAM lp);
+#endif
+	LRESULT SendDlgItemMessageA(int id, UINT msg, WPARAM wp, LPARAM lp);
+	void GetDlgItemTextT(int id, TCHAR *buf, size_t size);
+#if defined(UNICODE)
+	void GetDlgItemTextW(int id, wchar_t *buf, size_t size);
+#endif
+	void GetDlgItemTextA(int id, char *buf, size_t size);
+	void SetDlgItemTextT(int id, const TCHAR *str);
+#if defined(UNICODE)
+	void SetDlgItemTextW(int id, const wchar_t *str);
+#endif
+	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);
+	int GetCurSel(int id);
+	void SetDlgItemInt(int id, UINT val, BOOL bSigned = TRUE);
+	UINT GetDlgItemInt(int id, BOOL* lpTrans = NULL, BOOL bSigned = TRUE) const;
+	void EnableDlgItem(int id, BOOL enable);
+private:
+	void ModifyStyleCom(int nStyleOffset, DWORD dwRemove, DWORD dwAdd, UINT nFlags = 0);
+};
+
+class TTCFrameWnd : public TTCWnd
+{
+public:
+	TTCFrameWnd();
+	virtual ~TTCFrameWnd();
+	static TTCFrameWnd *pseudoPtr;
+	static LRESULT CALLBACK ProcStub(HWND hWnd, UINT msg, WPARAM wp, LPARAM lp);
+	virtual BOOL Create(HINSTANCE hInstance,
+						LPCTSTR lpszClassName,
+						LPCTSTR lpszWindowName,
+						DWORD dwStyle = WS_OVERLAPPEDWINDOW,
+						const RECT& rect = rectDefault,
+						HWND pParentWnd = NULL,        // != NULL for popups
+						LPCTSTR lpszMenuName = NULL,
+						DWORD dwExStyle = 0);//,
+						//CCreateContext* pContext = NULL);
+	virtual LRESULT Proc(UINT msg, WPARAM wp, LPARAM lp) = 0;
+	static const RECT rectDefault;
+	///
+	virtual BOOL OnCommand(WPARAM wParam, LPARAM lParam);
+	///
+#if 1
+	void OnKillFocus(HWND hNewWnd);
+	void OnDestroy();
+	void OnSetFocus(HWND hOldWnd);
+	void OnSysCommand(UINT nID, LPARAM lParam);
+	void OnClose();
+#endif
+	void OnSysKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
+	void OnSysKeyUp(UINT nChar, UINT nRepCnt, UINT nFlags);
+};
+
+class TTCDialog : public TTCWnd
+{
+public:
+	TTCDialog();
+	virtual ~TTCDialog();
+	BOOL Create(HINSTANCE hInstance, HWND hParent, int idd);
+	INT_PTR DoModal(HINSTANCE hInstance, HWND hParent, int idd);
+	void DestroyWindow();
+	virtual BOOL OnInitDialog();
+	virtual	BOOL OnOK();
+	virtual BOOL OnCancel();
+	virtual BOOL OnCommand(WPARAM wp, LPARAM lp);
+	virtual BOOL OnClose();
+	virtual BOOL PostNcDestroy();
+	virtual LRESULT DlgProc(UINT msg, WPARAM wp, LPARAM lp);
+
+	static LRESULT CALLBACK DlgProcStub(HWND hWnd, UINT msg, WPARAM wp, LPARAM lp);
+	static LRESULT CALLBACK WndProcStub(HWND hWnd, UINT msg, WPARAM wp, LPARAM lp);
+private:
+
+	LRESULT DlgProcBase(UINT msg, WPARAM wp, LPARAM lp);
+	LRESULT WndProcBase(UINT msg, WPARAM wp, LPARAM lp);
+	static TTCDialog *pseudoPtr;
+};
+
+class TTCPropertySheet
+{
+public:
+	TTCPropertySheet(HINSTANCE hInstance, LPCTSTR pszCaption, HWND hParentWnd);
+	virtual ~TTCPropertySheet();
+	virtual void OnInitDialog();
+	INT_PTR DoModal();
+	PROPSHEETHEADER m_psh;
+	HWND m_hWnd;
+	static int CALLBACK PropSheetProc(HWND hWnd, UINT msg, LPARAM lParam);
+	HINSTANCE m_hInst;
+};
+
+class TTCPropertyPage : public TTCWnd
+{
+public:
+	TTCPropertyPage(HINSTANCE inst, int id, TTCPropertySheet *sheet);
+	virtual ~TTCPropertyPage();
+	virtual void OnInitDialog();
+	virtual void OnOK();
+	virtual BOOL OnCommand(WPARAM wp, LPARAM lp);
+	virtual HBRUSH OnCtlColor(HDC hDC, HWND hWnd);
+
+	PROPSHEETPAGE m_psp;
+	static INT_PTR CALLBACK Proc(HWND hDlgWnd, UINT msg, WPARAM wp, LPARAM lp);
+	static UINT CALLBACK PropSheetPageProc(HWND hwnd, UINT uMsg, LPPROPSHEETPAGE ppsp);
+	TTCPropertySheet *m_pSheet;
+};
+

Added: trunk/teraterm/common/tmfc_frame.cpp
===================================================================
--- trunk/teraterm/common/tmfc_frame.cpp	                        (rev 0)
+++ trunk/teraterm/common/tmfc_frame.cpp	2019-03-28 16:38:16 UTC (rev 7525)
@@ -0,0 +1,132 @@
+/*
+ * Copyright (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.
+ */
+
+/*
+ * Tera term Micro Framework class
+ */
+#include "tmfc.h"
+#include "ttlib.h"
+
+#if (defined(_MSC_VER) && (_MSC_VER <= 1500)) || \
+	(__cplusplus <= 199711L)
+#define nullptr NULL	// C++11,nullptr / > VS2010
+#endif
+
+const RECT TTCFrameWnd::rectDefault =
+{
+	CW_USEDEFAULT, CW_USEDEFAULT,
+//	2*CW_USEDEFAULT, 2*CW_USEDEFAULTg
+	0, 0
+};
+
+TTCFrameWnd::TTCFrameWnd()
+{
+}
+
+TTCFrameWnd::~TTCFrameWnd()
+{
+}
+
+BOOL TTCFrameWnd::Create(
+	HINSTANCE hInstance,
+	LPCTSTR lpszClassName,
+	LPCTSTR lpszWindowName,
+	DWORD dwStyle,
+	const RECT& rect,
+	HWND hParentWnd,
+	LPCTSTR lpszMenuName,
+	DWORD dwExStyle)
+{
+	m_hInst = hInstance;
+	m_hParentWnd = hParentWnd;
+	pseudoPtr = this;
+	HWND hWnd = ::CreateWindowEx(
+		0,
+		lpszClassName,
+		lpszWindowName,
+		dwStyle,
+		rect.left, rect.top,
+		rect.right - rect.left, rect.bottom - rect.top,
+		hParentWnd,
+		nullptr,
+		hInstance,
+		nullptr);
+	pseudoPtr = nullptr;
+	if (hWnd == nullptr) {
+		OutputDebugPrintf("CreateWindow %d\n", GetLastError());
+		return FALSE;
+	} else {
+		m_hWnd = hWnd;
+		SetWindowLongPtr(GWLP_USERDATA, (LONG_PTR)this);
+		return TRUE;
+	}
+}
+
+TTCFrameWnd *TTCFrameWnd::pseudoPtr;
+
+LRESULT TTCFrameWnd::ProcStub(HWND hWnd, UINT msg, WPARAM wp, LPARAM lp)
+{
+	TTCFrameWnd *self;
+	if (pseudoPtr != nullptr) {
+		self = pseudoPtr;
+		self->m_hWnd = hWnd;
+	} else {
+		self = (TTCFrameWnd *)::GetWindowLongPtr(hWnd, GWLP_USERDATA);
+	}
+	return self->Proc(msg, wp, lp);
+}
+
+BOOL TTCFrameWnd::OnCommand(WPARAM wParam, LPARAM lParam)
+{
+	return FALSE;
+}
+
+void TTCFrameWnd::OnKillFocus(HWND hNewWnd)
+{}
+
+void TTCFrameWnd::OnDestroy()
+{}
+
+void TTCFrameWnd::OnSetFocus(HWND hOldWnd)
+{}
+
+void TTCFrameWnd::OnSysCommand(UINT nID, LPARAM lParam)
+{}
+
+void TTCFrameWnd::OnSysKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags)
+{
+	DefWindowProc(WM_SYSKEYDOWN, (WPARAM)nChar, MAKELONG(nRepCnt, nFlags));
+}
+
+void TTCFrameWnd::OnSysKeyUp(UINT nChar, UINT nRepCnt, UINT nFlags)
+{
+	DefWindowProc(WM_SYSKEYUP, (WPARAM)nChar, MAKELONG(nRepCnt, nFlags));
+}
+
+void TTCFrameWnd::OnClose()
+{}

Modified: trunk/teraterm/teraterm/CMakeLists.txt
===================================================================
--- trunk/teraterm/teraterm/CMakeLists.txt	2019-03-28 16:09:45 UTC (rev 7524)
+++ trunk/teraterm/teraterm/CMakeLists.txt	2019-03-28 16:38:16 UTC (rev 7525)
@@ -34,6 +34,9 @@
   ../common/compat_w95.h
   ../common/compat_win.h
   ../common/compat_win.cpp
+  ../common/tmfc.cpp
+  ../common/tmfc.h
+  ../common/tmfc_frame.cpp
   ../common/i18n.h
   ../common/dllutil.cpp
   ../common/dllutil.h

Modified: trunk/teraterm/teraterm/addsetting.cpp
===================================================================
--- trunk/teraterm/teraterm/addsetting.cpp	2019-03-28 16:09:45 UTC (rev 7524)
+++ trunk/teraterm/teraterm/addsetting.cpp	2019-03-28 16:38:16 UTC (rev 7525)
@@ -30,19 +30,28 @@
  * Additional settings dialog
  */
 
-#include <afxwin.h>
-#include <afxdlgs.h>
-#include <afxcmn.h>
+#include <stdio.h>
+#include <tchar.h>
+#include <windows.h>
 #include <commctrl.h>
+#include <time.h>
+#include <tchar.h>
 
 #include "addsetting.h"
 #include "teraterm.h"
 #include "tttypes.h"
-#include "ttwinman.h"
+#include "ttwinman.h"	// for ts
 #include "ttcommon.h"
 #include "ttftypes.h"
+#include "dlglib.h"
+#include "compat_win.h"
 
-mouse_cursor_t MouseCursor[] = {
+#undef GetDlgItemText
+#define GetDlgItemText GetDlgItemTextA
+#undef SetDlgItemText
+#define SetDlgItemText SetDlgItemTextA
+
+const mouse_cursor_t MouseCursor[] = {
 	{"ARROW", IDC_ARROW},
 	{"IBEAM", IDC_IBEAM},
 	{"CROSS", IDC_CROSS},
@@ -51,475 +60,275 @@
 };
 #define MOUSE_CURSOR_MAX (sizeof(MouseCursor)/sizeof(MouseCursor[0]) - 1)
 
-// \x96{\x91̂\xCD vtwin.cpp
-extern void SetWindowStyle(TTTSet *ts);
-
-
-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
 
-IMPLEMENT_DYNAMIC(CGeneralPropPageDlg, CPropertyPage)
-
-CGeneralPropPageDlg::CGeneralPropPageDlg()
-	: CPropertyPage(CGeneralPropPageDlg::IDD)
+CGeneralPropPageDlg::CGeneralPropPageDlg(HINSTANCE inst, TTCPropertySheet *sheet)
+	: TTCPropertyPage(inst, CGeneralPropPageDlg::IDD, sheet)
 {
+	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;
 }
 
 CGeneralPropPageDlg::~CGeneralPropPageDlg()
 {
-	if (DlgGeneralFont != NULL) {
-		DeleteObject(DlgGeneralFont);
-	}
+	free((void *)m_psp.pszTitle);
 }
 
-BEGIN_MESSAGE_MAP(CGeneralPropPageDlg, CPropertyPage)
-END_MESSAGE_MAP()
-
 // CGeneralPropPageDlg \x83\x81\x83b\x83Z\x81[\x83W \x83n\x83\x93\x83h\x83\x89
 
-BOOL CGeneralPropPageDlg::OnInitDialog()
+void CGeneralPropPageDlg::OnInitDialog()
 {
-	char uimsg[MAX_UIMSG];
-	char buf[64];
-	CButton *btn;
+	TTCPropertyPage::OnInitDialog();
 
-	CPropertyPage::OnInitDialog();
+	static const DlgTextInfo TextInfos[] = {
+		{ IDC_CLICKABLE_URL, "DLG_TAB_GENERAL_CLICKURL" },
+		{ IDC_DISABLE_SENDBREAK, "DLG_TAB_GENERAL_DISABLESENDBREAK" },
+		{ IDC_ACCEPT_BROADCAST, "DLG_TAB_GENERAL_ACCEPTBROADCAST" },
+		{ IDC_MOUSEWHEEL_SCROLL_LINE, "DLG_TAB_GENERAL_MOUSEWHEEL_SCROLL_LINE" },
+		{ IDC_AUTOSCROLL_ONLY_IN_BOTTOM_LINE, "DLG_TAB_GENERAL_AUTOSCROLL_ONLY_IN_BOTTOM_LINE" },
+		{ IDC_CLEAR_ON_RESIZE, "DLG_TAB_GENERAL_CLEAR_ON_RESIZE" },
+		{ IDC_CURSOR_CHANGE_IME, "DLG_TAB_GENERAL_CURSOR_CHANGE_IME" },
+		{ IDC_LIST_HIDDEN_FONTS, "DLG_TAB_GENERAL_LIST_HIDDEN_FONTS" },
+		{ IDC_TITLEFMT_GROUP, "DLG_TAB_GENERAL_TITLEFMT_GROUP" },
+		{ IDC_TITLEFMT_DISPHOSTNAME, "DLG_TAB_GENERAL_TITLEFMT_DISPHOSTNAME" },
+		{ IDC_TITLEFMT_DISPSESSION, "DLG_TAB_GENERAL_TITLEFMT_DISPSESSION" },
+		{ IDC_TITLEFMT_DISPVTTEK, "DLG_TAB_GENERAL_TITLEFMT_DISPVTTEK" },
+		{ IDC_TITLEFMT_SWAPHOSTTITLE, "DLG_TAB_GENERAL_TITLEFMT_SWAPHOSTTITLE" },
+		{ IDC_TITLEFMT_DISPTCPPORT, "DLG_TAB_GENERAL_TITLEFMT_DISPTCPPORT" },
+		{ IDC_TITLEFMT_DISPSERIALSPEED, "DLG_TAB_GENERAL_TITLEFMT_DISPSERIALSPEED" }
+	};
+	SetDlgTexts(m_hWnd, TextInfos, _countof(TextInfos), ts.UILanguageFile);
 
-	font = (HFONT)SendMessage(WM_GETFONT, 0, 0);
-	GetObject(font, sizeof(LOGFONT), &logfont);
-	if (get_lang_font("DLG_TAHOMA_FONT", GetSafeHwnd(), &logfont, &DlgGeneralFont, ts.UILanguageFile)) {
-		SendDlgItemMessage(IDC_CLICKABLE_URL, WM_SETFONT, (WPARAM)DlgGeneralFont, MAKELPARAM(TRUE,0));
-		SendDlgItemMessage(IDC_DISABLE_SENDBREAK, WM_SETFONT, (WPARAM)DlgGeneralFont, MAKELPARAM(TRUE,0));
-		SendDlgItemMessage(IDC_ACCEPT_BROADCAST, WM_SETFONT, (WPARAM)DlgGeneralFont, MAKELPARAM(TRUE,0)); // 337: 2007/03/20
-		SendDlgItemMessage(IDC_MOUSEWHEEL_SCROLL_LINE, WM_SETFONT, (WPARAM)DlgGeneralFont, MAKELPARAM(TRUE,0));
-		SendDlgItemMessage(IDC_SCROLL_LINE, WM_SETFONT, (WPARAM)DlgGeneralFont, MAKELPARAM(TRUE,0));
-		SendDlgItemMessage(IDC_AUTOSCROLL_ONLY_IN_BOTTOM_LINE, WM_SETFONT, (WPARAM)DlgGeneralFont, MAKELPARAM(TRUE,0));
-		SendDlgItemMessage(IDC_CLEAR_ON_RESIZE, WM_SETFONT, (WPARAM)DlgGeneralFont, MAKELPARAM(TRUE,0));
-		SendDlgItemMessage(IDC_CURSOR_CHANGE_IME, WM_SETFONT, (WPARAM)DlgGeneralFont, MAKELPARAM(TRUE,0));
-		SendDlgItemMessage(IDC_LIST_HIDDEN_FONTS, WM_SETFONT, (WPARAM)DlgGeneralFont, MAKELPARAM(TRUE,0));
-		SendDlgItemMessage(IDC_TITLEFMT_GROUP, WM_SETFONT, (WPARAM)DlgGeneralFont, MAKELPARAM(TRUE,0));
-		SendDlgItemMessage(IDC_TITLEFMT_DISPHOSTNAME, WM_SETFONT, (WPARAM)DlgGeneralFont, MAKELPARAM(TRUE,0));
-		SendDlgItemMessage(IDC_TITLEFMT_DISPSESSION, WM_SETFONT, (WPARAM)DlgGeneralFont, MAKELPARAM(TRUE,0));
-		SendDlgItemMessage(IDC_TITLEFMT_DISPVTTEK, WM_SETFONT, (WPARAM)DlgGeneralFont, MAKELPARAM(TRUE,0));
-		SendDlgItemMessage(IDC_TITLEFMT_SWAPHOSTTITLE, WM_SETFONT, (WPARAM)DlgGeneralFont, MAKELPARAM(TRUE,0));
-		SendDlgItemMessage(IDC_TITLEFMT_DISPTCPPORT, WM_SETFONT, (WPARAM)DlgGeneralFont, MAKELPARAM(TRUE,0));
-		SendDlgItemMessage(IDC_TITLEFMT_DISPSERIALSPEED, WM_SETFONT, (WPARAM)DlgGeneralFont, MAKELPARAM(TRUE,0));
-	}
-	else {
-		DlgGeneralFont = NULL;
-	}
-
-	GetDlgItemText(IDC_CLICKABLE_URL, uimsg, sizeof(uimsg));
-	get_lang_msg("DLG_TAB_GENERAL_CLICKURL", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
-	SetDlgItemText(IDC_CLICKABLE_URL, ts.UIMsg);
-	GetDlgItemText(IDC_DISABLE_SENDBREAK, uimsg, sizeof(uimsg));
-	get_lang_msg("DLG_TAB_GENERAL_DISABLESENDBREAK", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
-	SetDlgItemText(IDC_DISABLE_SENDBREAK, ts.UIMsg);
-	GetDlgItemText(IDC_ACCEPT_BROADCAST, uimsg, sizeof(uimsg));
-	get_lang_msg("DLG_TAB_GENERAL_ACCEPTBROADCAST", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
-	SetDlgItemText(IDC_ACCEPT_BROADCAST, ts.UIMsg);
-	GetDlgItemText(IDC_MOUSEWHEEL_SCROLL_LINE, uimsg, sizeof(uimsg));
-	get_lang_msg("DLG_TAB_GENERAL_MOUSEWHEEL_SCROLL_LINE", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
-	SetDlgItemText(IDC_MOUSEWHEEL_SCROLL_LINE, ts.UIMsg);
-	GetDlgItemText(IDC_AUTOSCROLL_ONLY_IN_BOTTOM_LINE, uimsg, sizeof(uimsg));
-	get_lang_msg("DLG_TAB_GENERAL_AUTOSCROLL_ONLY_IN_BOTTOM_LINE", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
-	SetDlgItemText(IDC_AUTOSCROLL_ONLY_IN_BOTTOM_LINE, ts.UIMsg);
-	GetDlgItemText(IDC_CLEAR_ON_RESIZE, uimsg, sizeof(uimsg));
-	get_lang_msg("DLG_TAB_GENERAL_CLEAR_ON_RESIZE", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
-	SetDlgItemText(IDC_CLEAR_ON_RESIZE, ts.UIMsg);
-	GetDlgItemText(IDC_CURSOR_CHANGE_IME, uimsg, sizeof(uimsg));
-	get_lang_msg("DLG_TAB_GENERAL_CURSOR_CHANGE_IME", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
-	SetDlgItemText(IDC_CURSOR_CHANGE_IME, ts.UIMsg);
-	GetDlgItemText(IDC_LIST_HIDDEN_FONTS, uimsg, sizeof(uimsg));
-	get_lang_msg("DLG_TAB_GENERAL_LIST_HIDDEN_FONTS", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
-	SetDlgItemText(IDC_LIST_HIDDEN_FONTS, ts.UIMsg);
-
-	GetDlgItemText(IDC_TITLEFMT_GROUP, uimsg, sizeof(uimsg));
-	get_lang_msg("DLG_TAB_GENERAL_TITLEFMT_GROUP", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
-	SetDlgItemText(IDC_TITLEFMT_GROUP, ts.UIMsg);
-	GetDlgItemText(IDC_TITLEFMT_DISPHOSTNAME, uimsg, sizeof(uimsg));
-	get_lang_msg("DLG_TAB_GENERAL_TITLEFMT_DISPHOSTNAME", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
-	SetDlgItemText(IDC_TITLEFMT_DISPHOSTNAME, ts.UIMsg);
-	GetDlgItemText(IDC_TITLEFMT_DISPSESSION, uimsg, sizeof(uimsg));
-	get_lang_msg("DLG_TAB_GENERAL_TITLEFMT_DISPSESSION", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
-	SetDlgItemText(IDC_TITLEFMT_DISPSESSION, ts.UIMsg);
-	GetDlgItemText(IDC_TITLEFMT_DISPVTTEK, uimsg, sizeof(uimsg));
-	get_lang_msg("DLG_TAB_GENERAL_TITLEFMT_DISPVTTEK", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
-	SetDlgItemText(IDC_TITLEFMT_DISPVTTEK, ts.UIMsg);
-	GetDlgItemText(IDC_TITLEFMT_SWAPHOSTTITLE, uimsg, sizeof(uimsg));
-	get_lang_msg("DLG_TAB_GENERAL_TITLEFMT_SWAPHOSTTITLE", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
-	SetDlgItemText(IDC_TITLEFMT_SWAPHOSTTITLE, ts.UIMsg);
-	GetDlgItemText(IDC_TITLEFMT_DISPTCPPORT, uimsg, sizeof(uimsg));
-	get_lang_msg("DLG_TAB_GENERAL_TITLEFMT_DISPTCPPORT", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
-	SetDlgItemText(IDC_TITLEFMT_DISPTCPPORT, ts.UIMsg);
-	GetDlgItemText(IDC_TITLEFMT_DISPSERIALSPEED, uimsg, sizeof(uimsg));
-	get_lang_msg("DLG_TAB_GENERAL_TITLEFMT_DISPSERIALSPEED", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
-	SetDlgItemText(IDC_TITLEFMT_DISPSERIALSPEED, ts.UIMsg);
-
 	// (1)DisableAcceleratorSendBreak
-	btn = (CButton *)GetDlgItem(IDC_DISABLE_SENDBREAK);
-	btn->SetCheck(ts.DisableAcceleratorSendBreak);
+	SetCheck(IDC_DISABLE_SENDBREAK, ts.DisableAcceleratorSendBreak);
 
 	// (2)EnableClickableUrl
-	btn = (CButton *)GetDlgItem(IDC_CLICKABLE_URL);
-	btn->SetCheck(ts.EnableClickableUrl);
+	SetCheck(IDC_CLICKABLE_URL, ts.EnableClickableUrl);
 
 	// (3)AcceptBroadcast 337: 2007/03/20
-	btn = (CButton *)GetDlgItem(IDC_ACCEPT_BROADCAST);
-	btn->SetCheck(ts.AcceptBroadcast);
+	SetCheck(IDC_ACCEPT_BROADCAST, ts.AcceptBroadcast);
 
 	// (4)IDC_MOUSEWHEEL_SCROLL_LINE
-	_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
-	btn = (CButton *)GetDlgItem(IDC_AUTOSCROLL_ONLY_IN_BOTTOM_LINE);
-	btn->SetCheck(ts.AutoScrollOnlyInBottomLine);
+	SetCheck(IDC_AUTOSCROLL_ONLY_IN_BOTTOM_LINE, ts.AutoScrollOnlyInBottomLine);
 
 	// (6)IDC_CLEAR_ON_RESIZE
-	btn = (CButton *)GetDlgItem(IDC_CLEAR_ON_RESIZE);
-	btn->SetCheck((ts.TermFlag & TF_CLEARONRESIZE) != 0);
+	SetCheck(IDC_CLEAR_ON_RESIZE, (ts.TermFlag & TF_CLEARONRESIZE) != 0);
 
 	// (7)IDC_CURSOR_CHANGE_IME
-	btn = (CButton *)GetDlgItem(IDC_CURSOR_CHANGE_IME);
-	btn->SetCheck((ts.WindowFlag & WF_IMECURSORCHANGE) != 0);
+	SetCheck(IDC_CURSOR_CHANGE_IME, (ts.WindowFlag & WF_IMECURSORCHANGE) != 0);
 
 	// (8)IDC_LIST_HIDDEN_FONTS
-	btn = (CButton *)GetDlgItem(IDC_LIST_HIDDEN_FONTS);
-	btn->SetCheck(ts.ListHiddenFonts);
+	SetCheck(IDC_LIST_HIDDEN_FONTS, ts.ListHiddenFonts);
 
 	// (9) Title Format
-	btn = (CButton *)GetDlgItem(IDC_TITLEFMT_DISPHOSTNAME);
-	btn->SetCheck((ts.TitleFormat & 1) != 0);
+	SetCheck(IDC_TITLEFMT_DISPHOSTNAME, (ts.TitleFormat & 1) != 0);
+	SetCheck(IDC_TITLEFMT_DISPSESSION, (ts.TitleFormat & (1<<1)) != 0);
+	SetCheck(IDC_TITLEFMT_DISPVTTEK, (ts.TitleFormat & (1<<2)) != 0);
+	SetCheck(IDC_TITLEFMT_SWAPHOSTTITLE, (ts.TitleFormat & (1<<3)) != 0);
+	SetCheck(IDC_TITLEFMT_DISPTCPPORT, (ts.TitleFormat & (1<<4)) != 0);
+	SetCheck(IDC_TITLEFMT_DISPSERIALSPEED, (ts.TitleFormat & (1<<5)) != 0);
 
-	btn = (CButton *)GetDlgItem(IDC_TITLEFMT_DISPSESSION);
-	btn->SetCheck((ts.TitleFormat & (1<<1)) != 0);
-
-	btn = (CButton *)GetDlgItem(IDC_TITLEFMT_DISPVTTEK);
-	btn->SetCheck((ts.TitleFormat & (1<<2)) != 0);
-
-	btn = (CButton *)GetDlgItem(IDC_TITLEFMT_SWAPHOSTTITLE);
-	btn->SetCheck((ts.TitleFormat & (1<<3)) != 0);
-
-	btn = (CButton *)GetDlgItem(IDC_TITLEFMT_DISPTCPPORT);
-	btn->SetCheck((ts.TitleFormat & (1<<4)) != 0);
-
-	btn = (CButton *)GetDlgItem(IDC_TITLEFMT_DISPSERIALSPEED);
-	btn->SetCheck((ts.TitleFormat & (1<<5)) != 0);
-
 	// \x83_\x83C\x83A\x83\x8D\x83O\x82Ƀt\x83H\x81[\x83J\x83X\x82𓖂Ă\xE9 (2004.12.7 yutaka)
 	::SetFocus(::GetDlgItem(GetSafeHwnd(), IDC_CLICKABLE_URL));
-
-	return FALSE;
 }
 
 void CGeneralPropPageDlg::OnOK()
 {
-	CButton *btn;
-	char buf[64];
+	TCHAR buf[64];
 	int val;
 
 	// (1)
-	btn = (CButton *)GetDlgItem(IDC_DISABLE_SENDBREAK);
-	ts.DisableAcceleratorSendBreak = btn->GetCheck();
+	ts.DisableAcceleratorSendBreak = GetCheck(IDC_DISABLE_SENDBREAK);
 
 	// (2)
-	btn = (CButton *)GetDlgItem(IDC_CLICKABLE_URL);
-	ts.EnableClickableUrl = btn->GetCheck();
+	ts.EnableClickableUrl = GetCheck(IDC_CLICKABLE_URL);
 
 	// (3) 337: 2007/03/20
-	btn = (CButton *)GetDlgItem(IDC_ACCEPT_BROADCAST);
-	ts.AcceptBroadcast = btn->GetCheck();
+	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;
 
 	// (5)IDC_AUTOSCROLL_ONLY_IN_BOTTOM_LINE
-	btn = (CButton *)GetDlgItem(IDC_AUTOSCROLL_ONLY_IN_BOTTOM_LINE);
-	ts.AutoScrollOnlyInBottomLine = btn->GetCheck();
+	ts.AutoScrollOnlyInBottomLine = GetCheck(IDC_AUTOSCROLL_ONLY_IN_BOTTOM_LINE);
 
 	// (6)IDC_CLEAR_ON_RESIZE
-	btn = (CButton *)GetDlgItem(IDC_CLEAR_ON_RESIZE);
-	if (((ts.TermFlag & TF_CLEARONRESIZE) != 0) != btn->GetCheck()) {
+	if (((ts.TermFlag & TF_CLEARONRESIZE) != 0) != GetCheck(IDC_CLEAR_ON_RESIZE)) {
 		ts.TermFlag ^= TF_CLEARONRESIZE;
 	}
 
 	// (7)IDC_CURSOR_CHANGE_IME
-	btn = (CButton *)GetDlgItem(IDC_CURSOR_CHANGE_IME);
-	if (((ts.WindowFlag & WF_IMECURSORCHANGE) != 0) != btn->GetCheck()) {
+	if (((ts.WindowFlag & WF_IMECURSORCHANGE) != 0) != GetCheck(IDC_CURSOR_CHANGE_IME)) {
 		ts.WindowFlag ^= WF_IMECURSORCHANGE;
 	}
 
 	// (8)IDC_LIST_HIDDEN_FONTS
-	btn = (CButton *)GetDlgItem(IDC_LIST_HIDDEN_FONTS);
-	ts.ListHiddenFonts = btn->GetCheck();
+	ts.ListHiddenFonts = GetCheck(IDC_LIST_HIDDEN_FONTS);
 
 	// (9) Title Format
-	btn = (CButton *)GetDlgItem(IDC_TITLEFMT_DISPHOSTNAME);
-	ts.TitleFormat = (btn->GetCheck() == BST_CHECKED);
-	btn = (CButton *)GetDlgItem(IDC_TITLEFMT_DISPSESSION);
-	ts.TitleFormat |= ((btn->GetCheck() == BST_CHECKED) << 1);
-	btn = (CButton *)GetDlgItem(IDC_TITLEFMT_DISPVTTEK);
-	ts.TitleFormat |= ((btn->GetCheck() == BST_CHECKED) << 2);
-	btn = (CButton *)GetDlgItem(IDC_TITLEFMT_SWAPHOSTTITLE);
-	ts.TitleFormat |= ((btn->GetCheck() == BST_CHECKED) << 3);
-	btn = (CButton *)GetDlgItem(IDC_TITLEFMT_DISPTCPPORT);
-	ts.TitleFormat |= ((btn->GetCheck() == BST_CHECKED) << 4);
-	btn = (CButton *)GetDlgItem(IDC_TITLEFMT_DISPSERIALSPEED);
-	ts.TitleFormat |= ((btn->GetCheck() == BST_CHECKED) << 5);
+	ts.TitleFormat = GetCheck(IDC_TITLEFMT_DISPHOSTNAME) == BST_CHECKED;
+	ts.TitleFormat |= (GetCheck(IDC_TITLEFMT_DISPSESSION) == BST_CHECKED) << 1;
+	ts.TitleFormat |= (GetCheck(IDC_TITLEFMT_DISPVTTEK) == BST_CHECKED) << 2;
+	ts.TitleFormat |= (GetCheck(IDC_TITLEFMT_SWAPHOSTTITLE) == BST_CHECKED) << 3;
+	ts.TitleFormat |= (GetCheck(IDC_TITLEFMT_DISPTCPPORT) == BST_CHECKED) << 4;
+	ts.TitleFormat |= (GetCheck(IDC_TITLEFMT_DISPSERIALSPEED) == BST_CHECKED) << 5;
 }
 
-
-
 // CSequencePropPageDlg \x83_\x83C\x83A\x83\x8D\x83O
 
-IMPLEMENT_DYNAMIC(CSequencePropPageDlg, CPropertyPage)
-
-CSequencePropPageDlg::CSequencePropPageDlg()
-	: CPropertyPage(CSequencePropPageDlg::IDD)
+CSequencePropPageDlg::CSequencePropPageDlg(HINSTANCE inst, TTCPropertySheet *sheet)
+	: TTCPropertyPage(inst, CSequencePropPageDlg::IDD, sheet)
 {
+	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;
 }
 
 CSequencePropPageDlg::~CSequencePropPageDlg()
 {
-	if (DlgSequenceFont != NULL) {
-		DeleteObject(DlgSequenceFont);
-	}
+	free((void *)m_psp.pszTitle);
 }
 
-BEGIN_MESSAGE_MAP(CSequencePropPageDlg, CPropertyPage)
-END_MESSAGE_MAP()
-
 // CSequencePropPageDlg \x83\x81\x83b\x83Z\x81[\x83W \x83n\x83\x93\x83h\x83\x89
 
-BOOL CSequencePropPageDlg::OnInitDialog()
+void CSequencePropPageDlg::OnInitDialog()
 {
-	char uimsg[MAX_UIMSG];
-	CButton *btn, *btn2;
-	CComboBox *cmb;
+	TTCPropertyPage::OnInitDialog();
 
-	CPropertyPage::OnInitDialog();
+	static const DlgTextInfo TextInfos[] = {
+		{ IDC_ACCEPT_MOUSE_EVENT_TRACKING, "DLG_TAB_SEQUENCE_ACCEPT_MOUSE_EVENT_TRACKING" },
+		{ IDC_DISABLE_MOUSE_TRACKING_CTRL, "DLG_TAB_SEQUENCE_DISABLE_MOUSE_TRACKING_CTRL" },
+		{ IDC_ACCEPT_TITLE_CHANGING_LABEL, "DLG_TAB_SEQUENCE_ACCEPT_TITLE_CHANGING" },
 
-	font = (HFONT)SendMessage(WM_GETFONT, 0, 0);
-	GetObject(font, sizeof(LOGFONT), &logfont);
-	if (get_lang_font("DLG_TAHOMA_FONT", GetSafeHwnd(), &logfont, &DlgSequenceFont, ts.UILanguageFile)) {
-		SendDlgItemMessage(IDC_ACCEPT_MOUSE_EVENT_TRACKING, WM_SETFONT, (WPARAM)DlgSequenceFont, MAKELPARAM(TRUE,0));
-		SendDlgItemMessage(IDC_DISABLE_MOUSE_TRACKING_CTRL, WM_SETFONT, (WPARAM)DlgSequenceFont, MAKELPARAM(TRUE,0));
-		SendDlgItemMessage(IDC_ACCEPT_TITLE_CHANGING_LABEL, WM_SETFONT, (WPARAM)DlgSequenceFont, MAKELPARAM(TRUE,0));
-		SendDlgItemMessage(IDC_ACCEPT_TITLE_CHANGING, WM_SETFONT, (WPARAM)DlgSequenceFont, MAKELPARAM(TRUE,0));
-		SendDlgItemMessage(IDC_TITLE_REPORT_LABEL, WM_SETFONT, (WPARAM)DlgSequenceFont, MAKELPARAM(TRUE,0));
-		SendDlgItemMessage(IDC_TITLE_REPORT, WM_SETFONT, (WPARAM)DlgSequenceFont, MAKELPARAM(TRUE,0));
-		SendDlgItemMessage(IDC_WINDOW_CTRL, WM_SETFONT, (WPARAM)DlgSequenceFont, MAKELPARAM(TRUE,0));
-		SendDlgItemMessage(IDC_WINDOW_REPORT, WM_SETFONT, (WPARAM)DlgSequenceFont, MAKELPARAM(TRUE,0));
-		SendDlgItemMessage(IDC_CURSOR_CTRL_SEQ, WM_SETFONT, (WPARAM)DlgSequenceFont, MAKELPARAM(TRUE,0));
-		SendDlgItemMessage(IDC_CLIPBOARD_ACCESS_LABEL, WM_SETFONT, (WPARAM)DlgSequenceFont, MAKELPARAM(TRUE,0));
-		SendDlgItemMessage(IDC_CLIPBOARD_ACCESS, WM_SETFONT, (WPARAM)DlgSequenceFont, MAKELPARAM(TRUE,0));
-		SendDlgItemMessage(IDC_CLIPBOARD_NOTIFY, WM_SETFONT, (WPARAM)DlgSequenceFont, MAKELPARAM(TRUE,0));
-	}
-	else {
-		DlgSequenceFont = NULL;
-	}
+		{ IDC_CURSOR_CTRL_SEQ, "DLG_TAB_SEQUENCE_CURSOR_CTRL" },
+		{ IDC_WINDOW_CTRL, "DLG_TAB_SEQUENCE_WINDOW_CTRL" },
+		{ IDC_WINDOW_REPORT, "DLG_TAB_SEQUENCE_WINDOW_REPORT" },
+		{ IDC_TITLE_REPORT_LABEL, "DLG_TAB_SEQUENCE_TITLE_REPORT" },
 
-	GetDlgItemText(IDC_ACCEPT_MOUSE_EVENT_TRACKING, uimsg, sizeof(uimsg));
-	get_lang_msg("DLG_TAB_SEQUENCE_ACCEPT_MOUSE_EVENT_TRACKING", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
-	SetDlgItemText(IDC_ACCEPT_MOUSE_EVENT_TRACKING, ts.UIMsg);
-	GetDlgItemText(IDC_DISABLE_MOUSE_TRACKING_CTRL, uimsg, sizeof(uimsg));
-	get_lang_msg("DLG_TAB_SEQUENCE_DISABLE_MOUSE_TRACKING_CTRL", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
-	SetDlgItemText(IDC_DISABLE_MOUSE_TRACKING_CTRL, ts.UIMsg);
-	GetDlgItemText(IDC_ACCEPT_TITLE_CHANGING_LABEL, uimsg, sizeof(uimsg));
-	get_lang_msg("DLG_TAB_SEQUENCE_ACCEPT_TITLE_CHANGING", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
-	SetDlgItemText(IDC_ACCEPT_TITLE_CHANGING_LABEL, ts.UIMsg);
+		{ IDC_CLIPBOARD_ACCESS_LABEL, "DLG_TAB_SEQUENCE_CLIPBOARD_ACCESS" },
 
-	get_lang_msg("DLG_TAB_SEQUENCE_ACCEPT_TITLE_CHANGING_OFF", ts.UIMsg, sizeof(ts.UIMsg), "off", ts.UILanguageFile);
-	SendDlgItemMessage(IDC_ACCEPT_TITLE_CHANGING, CB_ADDSTRING, 0, (LPARAM)ts.UIMsg);
-	get_lang_msg("DLG_TAB_SEQUENCE_ACCEPT_TITLE_CHANGING_OVERWRITE", ts.UIMsg, sizeof(ts.UIMsg), "overwrite", ts.UILanguageFile);
-	SendDlgItemMessage(IDC_ACCEPT_TITLE_CHANGING, CB_ADDSTRING, 0, (LPARAM)ts.UIMsg);
-	get_lang_msg("DLG_TAB_SEQUENCE_ACCEPT_TITLE_CHANGING_AHEAD", ts.UIMsg, sizeof(ts.UIMsg), "ahead", ts.UILanguageFile);
-	SendDlgItemMessage(IDC_ACCEPT_TITLE_CHANGING, CB_ADDSTRING, 0, (LPARAM)ts.UIMsg);
-	get_lang_msg("DLG_TAB_SEQUENCE_ACCEPT_TITLE_CHANGING_LAST", ts.UIMsg, sizeof(ts.UIMsg), "last", ts.UILanguageFile);
-	SendDlgItemMessage(IDC_ACCEPT_TITLE_CHANGING, CB_ADDSTRING, 0, (LPARAM)ts.UIMsg);
+		{ IDC_CLIPBOARD_NOTIFY, "DLG_TAB_SEQUENCE_CLIPBOARD_NOTIFY" },
+	};
+	SetDlgTexts(m_hWnd, TextInfos, _countof(TextInfos), ts.UILanguageFile);
 
-	GetDlgItemText(IDC_CURSOR_CTRL_SEQ, uimsg, sizeof(uimsg));
-	get_lang_msg("DLG_TAB_SEQUENCE_CURSOR_CTRL", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
-	SetDlgItemText(IDC_CURSOR_CTRL_SEQ, ts.UIMsg);
-	GetDlgItemText(IDC_WINDOW_CTRL, uimsg, sizeof(uimsg));
-	get_lang_msg("DLG_TAB_SEQUENCE_WINDOW_CTRL", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
-	SetDlgItemText(IDC_WINDOW_CTRL, ts.UIMsg);
-	GetDlgItemText(IDC_WINDOW_REPORT, uimsg, sizeof(uimsg));
-	get_lang_msg("DLG_TAB_SEQUENCE_WINDOW_REPORT", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
-	SetDlgItemText(IDC_WINDOW_REPORT, ts.UIMsg);
-	GetDlgItemText(IDC_TITLE_REPORT_LABEL, uimsg, sizeof(uimsg));
-	get_lang_msg("DLG_TAB_SEQUENCE_TITLE_REPORT", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
-	SetDlgItemText(IDC_TITLE_REPORT_LABEL, ts.UIMsg);
+	TCHAR uimsg[MAX_UIMSG];
+	get_lang_msgT("DLG_TAB_SEQUENCE_ACCEPT_TITLE_CHANGING_OFF", uimsg, _countof(uimsg), _T("off"), ts.UILanguageFile);
+	SendDlgItemMessage(IDC_ACCEPT_TITLE_CHANGING, CB_ADDSTRING, 0, (LPARAM)uimsg);
+	get_lang_msgT("DLG_TAB_SEQUENCE_ACCEPT_TITLE_CHANGING_OVERWRITE", uimsg, _countof(uimsg), _T("overwrite"), ts.UILanguageFile);
+	SendDlgItemMessage(IDC_ACCEPT_TITLE_CHANGING, CB_ADDSTRING, 0, (LPARAM)uimsg);
+	get_lang_msgT("DLG_TAB_SEQUENCE_ACCEPT_TITLE_CHANGING_AHEAD", uimsg, _countof(uimsg), _T("ahead"), ts.UILanguageFile);
+	SendDlgItemMessage(IDC_ACCEPT_TITLE_CHANGING, CB_ADDSTRING, 0, (LPARAM)uimsg);
+	get_lang_msgT("DLG_TAB_SEQUENCE_ACCEPT_TITLE_CHANGING_LAST", uimsg, _countof(uimsg), _T("last"), ts.UILanguageFile);
+	SendDlgItemMessage(IDC_ACCEPT_TITLE_CHANGING, CB_ADDSTRING, 0, (LPARAM)uimsg);
 
-	get_lang_msg("DLG_TAB_SEQUENCE_TITLE_REPORT_IGNORE", ts.UIMsg, sizeof(ts.UIMsg), "ignore", ts.UILanguageFile);
-	SendDlgItemMessage(IDC_TITLE_REPORT, CB_ADDSTRING, 0, (LPARAM)ts.UIMsg);
-	get_lang_msg("DLG_TAB_SEQUENCE_TITLE_REPORT_ACCEPT", ts.UIMsg, sizeof(ts.UIMsg), "accept", ts.UILanguageFile);
-	SendDlgItemMessage(IDC_TITLE_REPORT, CB_ADDSTRING, 0, (LPARAM)ts.UIMsg);
-	get_lang_msg("DLG_TAB_SEQUENCE_TITLE_REPORT_EMPTY", ts.UIMsg, sizeof(ts.UIMsg), "empty", ts.UILanguageFile);
-	SendDlgItemMessage(IDC_TITLE_REPORT, CB_ADDSTRING, 0, (LPARAM)ts.UIMsg);
+	get_lang_msgT("DLG_TAB_SEQUENCE_TITLE_REPORT_IGNORE", uimsg, _countof(uimsg), _T("ignore"), ts.UILanguageFile);
+	SendDlgItemMessage(IDC_TITLE_REPORT, CB_ADDSTRING, 0, (LPARAM)uimsg);
+	get_lang_msgT("DLG_TAB_SEQUENCE_TITLE_REPORT_ACCEPT", uimsg, _countof(uimsg), _T("accept"), ts.UILanguageFile);
+	SendDlgItemMessage(IDC_TITLE_REPORT, CB_ADDSTRING, 0, (LPARAM)uimsg);
+	get_lang_msgT("DLG_TAB_SEQUENCE_TITLE_REPORT_EMPTY", uimsg, _countof(uimsg), _T("empty"), ts.UILanguageFile);
+	SendDlgItemMessage(IDC_TITLE_REPORT, CB_ADDSTRING, 0, (LPARAM)uimsg);
 
-	GetDlgItemText(IDC_CLIPBOARD_ACCESS_LABEL, uimsg, sizeof(uimsg));
-	get_lang_msg("DLG_TAB_SEQUENCE_CLIPBOARD_ACCESS", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
-	SetDlgItemText(IDC_CLIPBOARD_ACCESS_LABEL, ts.UIMsg);
+	get_lang_msgT("DLG_TAB_SEQUENCE_CLIPBOARD_ACCESS_OFF", uimsg, _countof(uimsg), _T("off"), ts.UILanguageFile);
+	SendDlgItemMessage(IDC_CLIPBOARD_ACCESS, CB_ADDSTRING, 0, (LPARAM)uimsg);
+	get_lang_msgT("DLG_TAB_SEQUENCE_CLIPBOARD_ACCESS_WRITE", uimsg, _countof(uimsg), _T("write only"), ts.UILanguageFile);
+	SendDlgItemMessage(IDC_CLIPBOARD_ACCESS, CB_ADDSTRING, 0, (LPARAM)uimsg);
+	get_lang_msgT("DLG_TAB_SEQUENCE_CLIPBOARD_ACCESS_READ", uimsg, _countof(uimsg), _T("read only"), ts.UILanguageFile);
+	SendDlgItemMessage(IDC_CLIPBOARD_ACCESS, CB_ADDSTRING, 0, (LPARAM)uimsg);
+	get_lang_msgT("DLG_TAB_SEQUENCE_CLIPBOARD_ACCESS_ON", uimsg, _countof(uimsg), _T("read/write"), ts.UILanguageFile);
+	SendDlgItemMessage(IDC_CLIPBOARD_ACCESS, CB_ADDSTRING, 0, (LPARAM)uimsg);
 
-	get_lang_msg("DLG_TAB_SEQUENCE_CLIPBOARD_ACCESS_OFF", ts.UIMsg, sizeof(ts.UIMsg), "off", ts.UILanguageFile);
-	SendDlgItemMessage(IDC_CLIPBOARD_ACCESS, CB_ADDSTRING, 0, (LPARAM)ts.UIMsg);
-	get_lang_msg("DLG_TAB_SEQUENCE_CLIPBOARD_ACCESS_WRITE", ts.UIMsg, sizeof(ts.UIMsg), "write only", ts.UILanguageFile);
-	SendDlgItemMessage(IDC_CLIPBOARD_ACCESS, CB_ADDSTRING, 0, (LPARAM)ts.UIMsg);
-	get_lang_msg("DLG_TAB_SEQUENCE_CLIPBOARD_ACCESS_READ", ts.UIMsg, sizeof(ts.UIMsg), "read only", ts.UILanguageFile);
-	SendDlgItemMessage(IDC_CLIPBOARD_ACCESS, CB_ADDSTRING, 0, (LPARAM)ts.UIMsg);
-	get_lang_msg("DLG_TAB_SEQUENCE_CLIPBOARD_ACCESS_ON", ts.UIMsg, sizeof(ts.UIMsg), "read/write", ts.UILanguageFile);
-	SendDlgItemMessage(IDC_CLIPBOARD_ACCESS, CB_ADDSTRING, 0, (LPARAM)ts.UIMsg);
-
-	GetDlgItemText(IDC_CLIPBOARD_NOTIFY, uimsg, sizeof(uimsg));
-	get_lang_msg("DLG_TAB_SEQUENCE_CLIPBOARD_NOTIFY", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
-	SetDlgItemText(IDC_CLIPBOARD_NOTIFY, ts.UIMsg);
-
 	// (1)IDC_ACCEPT_MOUSE_EVENT_TRACKING
-	btn = (CButton *)GetDlgItem(IDC_ACCEPT_MOUSE_EVENT_TRACKING);
-	btn2 = (CButton *)GetDlgItem(IDC_DISABLE_MOUSE_TRACKING_CTRL);
-	btn->SetCheck(ts.MouseEventTracking);
-	if (ts.MouseEventTracking) {
-		btn2->EnableWindow(TRUE);
-	} else {
-		btn2->EnableWindow(FALSE);
-	}
+	SetCheck(IDC_ACCEPT_MOUSE_EVENT_TRACKING, ts.MouseEventTracking);
+	EnableDlgItem(IDC_DISABLE_MOUSE_TRACKING_CTRL, ts.MouseEventTracking ? TRUE : FALSE);
 
 	// (2)IDC_DISABLE_MOUSE_TRACKING_CTRL
-	btn2->SetCheck(ts.DisableMouseTrackingByCtrl);
+	SetCheck(IDC_DISABLE_MOUSE_TRACKING_CTRL, ts.DisableMouseTrackingByCtrl);
 
 	// (3)IDC_ACCEPT_TITLE_CHANGING
-	cmb = (CComboBox *)GetDlgItem(IDC_ACCEPT_TITLE_CHANGING);
-	cmb->SetCurSel(ts.AcceptTitleChangeRequest);
+	SetCurSel(IDC_ACCEPT_TITLE_CHANGING, ts.AcceptTitleChangeRequest);
 
 	// (4)IDC_TITLE_REPORT
-	cmb = (CComboBox *)GetDlgItem(IDC_TITLE_REPORT);
-	switch (ts.WindowFlag & WF_TITLEREPORT) {
-		case IdTitleReportIgnore:
-			cmb->SetCurSel(0);
-			break;
-		case IdTitleReportAccept:
-			cmb->SetCurSel(1);
-			break;
-		default: // IdTitleReportEmpty
-			cmb->SetCurSel(2);
-			break;
-	}
+	SetCurSel(IDC_TITLE_REPORT,
+			  (ts.WindowFlag & WF_TITLEREPORT) == IdTitleReportIgnore ? 0 :
+			  (ts.WindowFlag & WF_TITLEREPORT) == IdTitleReportAccept ? 1
+			  /*(ts.WindowFlag & WF_TITLEREPORT) == IdTitleReportEmptye ? */ : 2);
 
 	// (5)IDC_WINDOW_CTRL
-	btn = (CButton *)GetDlgItem(IDC_WINDOW_CTRL);
-	btn->SetCheck((ts.WindowFlag & WF_WINDOWCHANGE) != 0);
+	SetCheck(IDC_WINDOW_CTRL, (ts.WindowFlag & WF_WINDOWCHANGE) != 0);
 
 	// (6)IDC_WINDOW_REPORT
-	btn = (CButton *)GetDlgItem(IDC_WINDOW_REPORT);
-	btn->SetCheck((ts.WindowFlag & WF_WINDOWREPORT) != 0);
+	SetCheck(IDC_WINDOW_REPORT, (ts.WindowFlag & WF_WINDOWREPORT) != 0);
 
 	// (7)IDC_CURSOR_CTRL_SEQ
-	btn = (CButton *)GetDlgItem(IDC_CURSOR_CTRL_SEQ);
-	btn->SetCheck((ts.WindowFlag & WF_CURSORCHANGE) != 0);
+	SetCheck(IDC_CURSOR_CTRL_SEQ, (ts.WindowFlag & WF_CURSORCHANGE) != 0);
 
 	// (8)IDC_CLIPBOARD_ACCESS
-	cmb = (CComboBox *)GetDlgItem(IDC_CLIPBOARD_ACCESS);
-	switch (ts.CtrlFlag & CSF_CBRW) {
-		case CSF_CBRW:
-			cmb->SetCurSel(3);
-			break;
-		case CSF_CBREAD:
-			cmb->SetCurSel(2);
-			break;
-		case CSF_CBWRITE:
-			cmb->SetCurSel(1);
-			break;
-		default: // off
-			cmb->SetCurSel(0);
-			break;
-	}
+	SetCurSel(IDC_CLIPBOARD_ACCESS,
+			  (ts.CtrlFlag & CSF_CBRW) == CSF_CBRW ? 3 :
+			  (ts.CtrlFlag & CSF_CBRW) == CSF_CBREAD ? 2 :
+			  (ts.CtrlFlag & CSF_CBRW) == CSF_CBWRITE ? 1 :
+			  0);	// off
 
 	// (9)IDC_CLIPBOARD_NOTIFY
-	btn = (CButton *)GetDlgItem(IDC_CLIPBOARD_NOTIFY);
-	btn->SetCheck(ts.NotifyClipboardAccess);
-	if (HasBalloonTipSupport()) {
-		btn->EnableWindow(TRUE);
-	}
-	else {
-		btn->EnableWindow(FALSE);
-	}
+	SetCheck(IDC_CLIPBOARD_NOTIFY, ts.NotifyClipboardAccess);
+	EnableDlgItem(IDC_CLIPBOARD_NOTIFY, HasBalloonTipSupport() ? TRUE : FALSE);
 
 	// \x83_\x83C\x83A\x83\x8D\x83O\x82Ƀt\x83H\x81[\x83J\x83X\x82𓖂Ă\xE9 (2004.12.7 yutaka)
 	::SetFocus(::GetDlgItem(GetSafeHwnd(), IDC_ACCEPT_MOUSE_EVENT_TRACKING));
-
-	return FALSE;
 }
 
 BOOL CSequencePropPageDlg::OnCommand(WPARAM wParam, LPARAM lParam)
 {
-	CButton *btn, *btn2;
-
 	switch (wParam) {
 		case IDC_ACCEPT_MOUSE_EVENT_TRACKING | (BN_CLICKED << 16):
-			btn = (CButton *)GetDlgItem(IDC_ACCEPT_MOUSE_EVENT_TRACKING);
-			btn2 = (CButton *)GetDlgItem(IDC_DISABLE_MOUSE_TRACKING_CTRL);
-			if (btn->GetCheck()) {
-				btn2->EnableWindow(TRUE);
-			} else {
-				btn2->EnableWindow(FALSE);
-			}
+			EnableDlgItem(IDC_DISABLE_MOUSE_TRACKING_CTRL, 
+						  GetCheck(IDC_ACCEPT_MOUSE_EVENT_TRACKING) ? TRUE : FALSE);
 			return TRUE;
 	}
-	return CPropertyPage::OnCommand(wParam, lParam);
+	return TTCPropertyPage::OnCommand(wParam, lParam);
 }
 
 void CSequencePropPageDlg::OnOK()
 {
-	CButton *btn;
-	CComboBox *cmb;
-	int sel;
-
 	// (1)IDC_ACCEPT_MOUSE_EVENT_TRACKING
-	btn = (CButton *)GetDlgItem(IDC_ACCEPT_MOUSE_EVENT_TRACKING);
-	ts.MouseEventTracking = btn->GetCheck();
+	ts.MouseEventTracking = GetCheck(IDC_ACCEPT_MOUSE_EVENT_TRACKING);
 
 	// (2)IDC_DISABLE_MOUSE_TRACKING_CTRL
-	btn = (CButton *)GetDlgItem(IDC_DISABLE_MOUSE_TRACKING_CTRL);
-	ts.DisableMouseTrackingByCtrl = btn->GetCheck();
+	ts.DisableMouseTrackingByCtrl = GetCheck(IDC_DISABLE_MOUSE_TRACKING_CTRL);
 
 	// (3)IDC_ACCEPT_TITLE_CHANGING
-	cmb = (CComboBox *)GetDlgItem(IDC_ACCEPT_TITLE_CHANGING);
-	sel = cmb->GetCurSel();
+	int sel = GetCurSel(IDC_ACCEPT_TITLE_CHANGING);
 	if (0 <= sel && sel <= IdTitleChangeRequestMax) {
 		ts.AcceptTitleChangeRequest = sel;
 	}
 
 	// (4)IDC_TITLE_REPORT
-	cmb = (CComboBox *)GetDlgItem(IDC_TITLE_REPORT);
-	switch (cmb->GetCurSel()) {
+	switch (GetCurSel(IDC_TITLE_REPORT)) {
 		case 0:
 			ts.WindowFlag &= ~WF_TITLEREPORT;
 			break;
@@ -535,26 +344,22 @@
 	}
 
 	// (5)IDC_WINDOW_CTRL
-	btn = (CButton *)GetDlgItem(IDC_WINDOW_CTRL);
-	if (((ts.WindowFlag & WF_WINDOWCHANGE) != 0) != btn->GetCheck()) {
+	if (((ts.WindowFlag & WF_WINDOWCHANGE) != 0) != GetCheck(IDC_WINDOW_CTRL)) {
 		ts.WindowFlag ^= WF_WINDOWCHANGE;
 	}
 
 	// (6)IDC_WINDOW_REPORT
-	btn = (CButton *)GetDlgItem(IDC_WINDOW_REPORT);
-	if (((ts.WindowFlag & WF_WINDOWREPORT) != 0) != btn->GetCheck()) {
+	if (((ts.WindowFlag & WF_WINDOWREPORT) != 0) != GetCheck(IDC_WINDOW_REPORT)) {
 		ts.WindowFlag ^= WF_WINDOWREPORT;
 	}
 
 	// (7)IDC_CURSOR_CTRL_SEQ
-	btn = (CButton *)GetDlgItem(IDC_CURSOR_CTRL_SEQ);
-	if (((ts.WindowFlag & WF_CURSORCHANGE) != 0) != btn->GetCheck()) {
+	if (((ts.WindowFlag & WF_CURSORCHANGE) != 0) != GetCheck(IDC_CURSOR_CTRL_SEQ)) {
 		ts.WindowFlag ^= WF_CURSORCHANGE;
 	}
 
 	// (8)IDC_CLIPBOARD_ACCESS
-	cmb = (CComboBox *)GetDlgItem(IDC_CLIPBOARD_ACCESS);
-	switch (cmb->GetCurSel()) {
+	switch (GetCurSel(IDC_CLIPBOARD_ACCESS)) {
 		case 0: // off
 			ts.CtrlFlag &= ~CSF_CBRW;
 			break;
@@ -574,202 +379,127 @@
 	}
 
 	// (9)IDC_CLIPBOARD_ACCESS
-	btn = (CButton *)GetDlgItem(IDC_CLIPBOARD_NOTIFY);
-	ts.NotifyClipboardAccess = btn->GetCheck();
+	ts.NotifyClipboardAccess = GetCheck(IDC_CLIPBOARD_NOTIFY);
 }
 
 
-
 // CCopypastePropPageDlg \x83_\x83C\x83A\x83\x8D\x83O
 
-IMPLEMENT_DYNAMIC(CCopypastePropPageDlg, CPropertyPage)
-
-CCopypastePropPageDlg::CCopypastePropPageDlg()
-	: CPropertyPage(CCopypastePropPageDlg::IDD)
+CCopypastePropPageDlg::CCopypastePropPageDlg(HINSTANCE inst, TTCPropertySheet *sheet)
+	: TTCPropertyPage(inst, CCopypastePropPageDlg::IDD, sheet)
 {
+	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;
 }
 
 CCopypastePropPageDlg::~CCopypastePropPageDlg()
 {
-	if (DlgCopypasteFont != NULL) {
-		DeleteObject(DlgCopypasteFont);
-	}
+	free((void *)m_psp.pszTitle);
 }
 
-BEGIN_MESSAGE_MAP(CCopypastePropPageDlg, CPropertyPage)
-END_MESSAGE_MAP()
-
 // CCopypastePropPageDlg \x83\x81\x83b\x83Z\x81[\x83W \x83n\x83\x93\x83h\x83\x89
 
-BOOL CCopypastePropPageDlg::OnInitDialog()
+void CCopypastePropPageDlg::OnInitDialog()
 {
-	char uimsg[MAX_UIMSG];
-	CButton *btn, *btn2;
-	CEdit *edit;
-	char buf[64];
+	TTCPropertyPage::OnInitDialog();
 
-	CPropertyPage::OnInitDialog();
+	static const DlgTextInfo TextInfos[] = {
+		{ IDC_LINECOPY, "DLG_TAB_COPYPASTE_CONTINUE" },
+		{ IDC_DISABLE_PASTE_RBUTTON, "DLG_TAB_COPYPASTE_MOUSEPASTE" },
+		{ IDC_CONFIRM_PASTE_RBUTTON, "DLG_TAB_COPYPASTE_CONFIRMPASTE" },
+		{ IDC_DISABLE_PASTE_MBUTTON, "DLG_TAB_COPYPASTE_MOUSEPASTEM" },
+		{ IDC_SELECT_LBUTTON, "DLG_TAB_COPYPASTE_SELECTLBUTTON" },
+		{ IDC_TRIMNLCHAR, "DLG_TAB_COPYPASTE_TRIM_TRAILING_NL" },
+		{ IDC_NORMALIZE_LINEBREAK, "DLG_TAB_COPYPASTE_NORMALIZE_LINEBREAK" },
+		{ IDC_CONFIRM_CHANGE_PASTE, "DLG_TAB_COPYPASTE_CONFIRM_CHANGE_PASTE" },
+		{ IDC_CONFIRM_STRING_FILE_LABEL, "DLG_TAB_COPYPASTE_STRINGFILE" },
+		{ IDC_DELIMITER, "DLG_TAB_COPYPASTE_DELIMITER" },
+		{ IDC_PASTEDELAY_LABEL, "DLG_TAB_COPYPASTE_PASTEDELAY" },
+		{ IDC_PASTEDELAY_LABEL2, "DLG_TAB_COPYPASTE_PASTEDELAY2" }
+	};
+	SetDlgTexts(m_hWnd, TextInfos, _countof(TextInfos), ts.UILanguageFile);
 
-	font = (HFONT)SendMessage(WM_GETFONT, 0, 0);
-	GetObject(font, sizeof(LOGFONT), &logfont);
-	if (get_lang_font("DLG_TAHOMA_FONT", GetSafeHwnd(), &logfont, &DlgCopypasteFont, ts.UILanguageFile)) {
-		SendDlgItemMessage(IDC_LINECOPY, WM_SETFONT, (WPARAM)DlgCopypasteFont, MAKELPARAM(TRUE,0));
-		SendDlgItemMessage(IDC_DISABLE_PASTE_RBUTTON, WM_SETFONT, (WPARAM)DlgCopypasteFont, MAKELPARAM(TRUE,0));
-		SendDlgItemMessage(IDC_CONFIRM_PASTE_RBUTTON, WM_SETFONT, (WPARAM)DlgCopypasteFont, MAKELPARAM(TRUE,0));
-		SendDlgItemMessage(IDC_DISABLE_PASTE_MBUTTON, WM_SETFONT, (WPARAM)DlgCopypasteFont, MAKELPARAM(TRUE,0));
-		SendDlgItemMessage(IDC_SELECT_LBUTTON, WM_SETFONT, (WPARAM)DlgCopypasteFont, MAKELPARAM(TRUE,0));
-		SendDlgItemMessage(IDC_TRIMNLCHAR, WM_SETFONT, (WPARAM)DlgCopypasteFont, MAKELPARAM(TRUE,0));
-		SendDlgItemMessage(IDC_NORMALIZE_LINEBREAK, WM_SETFONT, (WPARAM)DlgCopypasteFont, MAKELPARAM(TRUE,0));
-		SendDlgItemMessage(IDC_CONFIRM_CHANGE_PASTE, WM_SETFONT, (WPARAM)DlgCopypasteFont, MAKELPARAM(TRUE,0));
-		SendDlgItemMessage(IDC_CONFIRM_STRING_FILE_LABEL, WM_SETFONT, (WPARAM)DlgCopypasteFont, MAKELPARAM(TRUE,0));
-		SendDlgItemMessage(IDC_CONFIRM_STRING_FILE, WM_SETFONT, (WPARAM)DlgCopypasteFont, MAKELPARAM(TRUE,0));
-		SendDlgItemMessage(IDC_CONFIRM_STRING_FILE_PATH, WM_SETFONT, (WPARAM)DlgCopypasteFont, MAKELPARAM(TRUE,0));
-		SendDlgItemMessage(IDC_DELIMITER, WM_SETFONT, (WPARAM)DlgCopypasteFont, MAKELPARAM(TRUE,0));
-		SendDlgItemMessage(IDC_DELIM_LIST, WM_SETFONT, (WPARAM)DlgCopypasteFont, MAKELPARAM(TRUE,0));
-		SendDlgItemMessage(IDC_PASTEDELAY_LABEL, WM_SETFONT, (WPARAM)DlgCopypasteFont, MAKELPARAM(TRUE,0));
-		SendDlgItemMessage(IDC_PASTEDELAY_EDIT, WM_SETFONT, (WPARAM)DlgCopypasteFont, MAKELPARAM(TRUE,0));
-		SendDlgItemMessage(IDC_PASTEDELAY_LABEL2, WM_SETFONT, (WPARAM)DlgCopypasteFont, MAKELPARAM(TRUE,0));
-	}
-	else {
-		DlgCopypasteFont = NULL;
-	}
-
-	GetDlgItemText(IDC_LINECOPY, uimsg, sizeof(uimsg));
-	get_lang_msg("DLG_TAB_COPYPASTE_CONTINUE", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
-	SetDlgItemText(IDC_LINECOPY, ts.UIMsg);
-	GetDlgItemText(IDC_DISABLE_PASTE_RBUTTON, uimsg, sizeof(uimsg));
-	get_lang_msg("DLG_TAB_COPYPASTE_MOUSEPASTE", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
-	SetDlgItemText(IDC_DISABLE_PASTE_RBUTTON, ts.UIMsg);
-	GetDlgItemText(IDC_CONFIRM_PASTE_RBUTTON, uimsg, sizeof(uimsg));
-	get_lang_msg("DLG_TAB_COPYPASTE_CONFIRMPASTE", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
-	SetDlgItemText(IDC_CONFIRM_PASTE_RBUTTON, ts.UIMsg);
-	GetDlgItemText(IDC_DISABLE_PASTE_MBUTTON, uimsg, sizeof(uimsg));
-	get_lang_msg("DLG_TAB_COPYPASTE_MOUSEPASTEM", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
-	SetDlgItemText(IDC_DISABLE_PASTE_MBUTTON, ts.UIMsg);
-	GetDlgItemText(IDC_SELECT_LBUTTON, uimsg, sizeof(uimsg));
-	get_lang_msg("DLG_TAB_COPYPASTE_SELECTLBUTTON", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
-	SetDlgItemText(IDC_SELECT_LBUTTON, ts.UIMsg);
-	GetDlgItemText(IDC_TRIMNLCHAR, uimsg, sizeof(uimsg));
-	get_lang_msg("DLG_TAB_COPYPASTE_TRIM_TRAILING_NL", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
-	SetDlgItemText(IDC_TRIMNLCHAR, ts.UIMsg);
-	GetDlgItemText(IDC_NORMALIZE_LINEBREAK, uimsg, sizeof(uimsg));
-	get_lang_msg("DLG_TAB_COPYPASTE_NORMALIZE_LINEBREAK", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
-	SetDlgItemText(IDC_NORMALIZE_LINEBREAK, ts.UIMsg);
-	GetDlgItemText(IDC_CONFIRM_CHANGE_PASTE, uimsg, sizeof(uimsg));
-	get_lang_msg("DLG_TAB_COPYPASTE_CONFIRM_CHANGE_PASTE", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
-	SetDlgItemText(IDC_CONFIRM_CHANGE_PASTE, ts.UIMsg);
-	GetDlgItemText(IDC_CONFIRM_STRING_FILE_LABEL, uimsg, sizeof(uimsg));
-	get_lang_msg("DLG_TAB_COPYPASTE_STRINGFILE", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
-	SetDlgItemText(IDC_CONFIRM_STRING_FILE_LABEL, ts.UIMsg);
-	GetDlgItemText(IDC_DELIMITER, uimsg, sizeof(uimsg));
-	get_lang_msg("DLG_TAB_COPYPASTE_DELIMITER", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
-	SetDlgItemText(IDC_DELIMITER, ts.UIMsg);
-	GetDlgItemText(IDC_PASTEDELAY_LABEL, uimsg, sizeof(uimsg));
-	get_lang_msg("DLG_TAB_COPYPASTE_PASTEDELAY", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
-	SetDlgItemText(IDC_PASTEDELAY_LABEL, ts.UIMsg);
-	GetDlgItemText(IDC_PASTEDELAY_LABEL2, uimsg, sizeof(uimsg));
-	get_lang_msg("DLG_TAB_COPYPASTE_PASTEDELAY2", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
-	SetDlgItemText(IDC_PASTEDELAY_LABEL2, ts.UIMsg);
-
 	// (1)Enable continued-line copy
-	btn = (CButton *)GetDlgItem(IDC_LINECOPY);
-	btn->SetCheck(ts.EnableContinuedLineCopy);
+	SetCheck(IDC_LINECOPY, ts.EnableContinuedLineCopy);
 
 	// (2)DisablePasteMouseRButton
-	btn = (CButton *)GetDlgItem(IDC_DISABLE_PASTE_RBUTTON);
-	btn2 = (CButton *)GetDlgItem(IDC_CONFIRM_PASTE_RBUTTON);
 	if (ts.PasteFlag & CPF_DISABLE_RBUTTON) {
-		btn->SetCheck(BST_CHECKED);
-		btn2->EnableWindow(FALSE);
+		SetCheck(IDC_DISABLE_PASTE_RBUTTON, BST_CHECKED);
+		EnableDlgItem(IDC_CONFIRM_PASTE_RBUTTON, FALSE);
 	} else {
-		btn->SetCheck(BST_UNCHECKED);
-		btn2->EnableWindow(TRUE);
+		SetCheck(IDC_DISABLE_PASTE_RBUTTON, BST_UNCHECKED);
+		EnableDlgItem(IDC_CONFIRM_PASTE_RBUTTON, TRUE);
 	}
 
 	// (3)ConfirmPasteMouseRButton
-	btn2->SetCheck((ts.PasteFlag & CPF_CONFIRM_RBUTTON)?BST_CHECKED:BST_UNCHECKED);
+	SetCheck(IDC_CONFIRM_PASTE_RBUTTON, (ts.PasteFlag & CPF_CONFIRM_RBUTTON)?BST_CHECKED:BST_UNCHECKED);
 
 	// (4)DisablePasteMouseMButton
-	btn = (CButton *)GetDlgItem(IDC_DISABLE_PASTE_MBUTTON);
-	btn->SetCheck((ts.PasteFlag & CPF_DISABLE_MBUTTON)?BST_CHECKED:BST_UNCHECKED);
+	SetCheck(IDC_DISABLE_PASTE_MBUTTON, (ts.PasteFlag & CPF_DISABLE_MBUTTON)?BST_CHECKED:BST_UNCHECKED);
 
 	// (5)SelectOnlyByLButton
-	btn = (CButton *)GetDlgItem(IDC_SELECT_LBUTTON);
-	btn->SetCheck(ts.SelectOnlyByLButton);
+	SetCheck(IDC_SELECT_LBUTTON, ts.SelectOnlyByLButton);
 
 	// (6)TrimTrailingNLonPaste
-	btn = (CButton *)GetDlgItem(IDC_TRIMNLCHAR);
-	btn->SetCheck((ts.PasteFlag & CPF_TRIM_TRAILING_NL)?BST_CHECKED:BST_UNCHECKED);
+	SetCheck(IDC_TRIMNLCHAR, (ts.PasteFlag & CPF_TRIM_TRAILING_NL)?BST_CHECKED:BST_UNCHECKED);
 
 	// (7)NormalizeLineBreak
-	btn = (CButton *)GetDlgItem(IDC_NORMALIZE_LINEBREAK);
-	btn->SetCheck((ts.PasteFlag & CPF_NORMALIZE_LINEBREAK)?BST_CHECKED:BST_UNCHECKED);
+	SetCheck(IDC_NORMALIZE_LINEBREAK, (ts.PasteFlag & CPF_NORMALIZE_LINEBREAK)?BST_CHECKED:BST_UNCHECKED);
 
 	// (8)ConfirmChangePaste
-	btn = (CButton *)GetDlgItem(IDC_CONFIRM_CHANGE_PASTE);
-	btn->SetCheck((ts.PasteFlag & CPF_CONFIRM_CHANGEPASTE)?BST_CHECKED:BST_UNCHECKED);
+	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);
-	edit = (CEdit *)GetDlgItem(IDC_CONFIRM_STRING_FILE);
-	btn = (CButton *)GetDlgItem(IDC_CONFIRM_STRING_FILE_PATH);
+	SetDlgItemTextA(IDC_CONFIRM_STRING_FILE, ts.ConfirmChangePasteStringFile);
 	if (ts.PasteFlag & CPF_CONFIRM_CHANGEPASTE) {
-		edit->EnableWindow(TRUE);
-		btn->EnableWindow(TRUE);
+		EnableDlgItem(IDC_CONFIRM_STRING_FILE, TRUE);
+		EnableDlgItem(IDC_CONFIRM_STRING_FILE_PATH, TRUE);
 	} else {
-		edit->EnableWindow(FALSE);
-		btn->EnableWindow(FALSE);
+		EnableDlgItem(IDC_CONFIRM_STRING_FILE, FALSE);
+		EnableDlgItem(IDC_CONFIRM_STRING_FILE_PATH, FALSE);
 	}
 
 	// (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));
-
-	return FALSE;
 }
 
 BOOL CCopypastePropPageDlg::OnCommand(WPARAM wParam, LPARAM lParam)
 {
-	CButton *btn, *btn2;
-	CEdit *edit;
 	char uimsg[MAX_UIMSG];
 
 	switch (wParam) {
 		case IDC_DISABLE_PASTE_RBUTTON | (BN_CLICKED << 16):
-			btn = (CButton *)GetDlgItem(IDC_DISABLE_PASTE_RBUTTON);
-			btn2 = (CButton *)GetDlgItem(IDC_CONFIRM_PASTE_RBUTTON);
-			if (btn->GetCheck()) {
-				btn2->EnableWindow(FALSE);
-			} else {
-				btn2->EnableWindow(TRUE);
-			}
+			EnableDlgItem(IDC_CONFIRM_PASTE_RBUTTON,
+						  GetCheck(IDC_DISABLE_PASTE_RBUTTON) ? FALSE : TRUE);
 			return TRUE;
 
 		case IDC_CONFIRM_CHANGE_PASTE | (BN_CLICKED << 16):
-			btn2 = (CButton *)GetDlgItem(IDC_CONFIRM_CHANGE_PASTE);
-			btn = (CButton *)GetDlgItem(IDC_CONFIRM_STRING_FILE_PATH);
-			edit = (CEdit *)GetDlgItem(IDC_CONFIRM_STRING_FILE);
-			if (btn2->GetCheck()) {
-				edit->EnableWindow(TRUE);
-				btn->EnableWindow(TRUE);
+			if (GetCheck(IDC_CONFIRM_CHANGE_PASTE)) {
+				EnableDlgItem(IDC_CONFIRM_STRING_FILE, TRUE);
+				EnableDlgItem(IDC_CONFIRM_STRING_FILE_PATH, TRUE);
 			} else {
-				edit->EnableWindow(FALSE);
-				btn->EnableWindow(FALSE);
+				EnableDlgItem(IDC_CONFIRM_STRING_FILE, FALSE);
+				EnableDlgItem(IDC_CONFIRM_STRING_FILE_PATH, FALSE);
 			}
 			return TRUE;
 
 		case IDC_CONFIRM_STRING_FILE_PATH | (BN_CLICKED << 16):
 			{
-				OPENFILENAME ofn;
+				OPENFILENAMEA ofn;
 
-				ZeroMemory(&ofn, sizeof(ofn));
-				ofn.lStructSize = get_OPENFILENAME_SIZE();
+				memset(&ofn, 0, sizeof(ofn));
+				ofn.lStructSize = get_OPENFILENAME_SIZEA();
 				ofn.hwndOwner = GetSafeHwnd();
 				get_lang_msg("FILEDLG_SELECT_CONFIRM_STRING_APP_FILTER", ts.UIMsg, sizeof(ts.UIMsg),
 				             "txt(*.txt)\\0*.txt\\0all(*.*)\\0*.*\\0\\0", ts.UILanguageFile);
@@ -780,29 +510,26 @@
 				             "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;
 	}
 
-	return CPropertyPage::OnCommand(wParam, lParam);
+	return TTCPropertyPage::OnCommand(wParam, lParam);
 }
 
 void CCopypastePropPageDlg::OnOK()
 {
-	CButton *btn;
 	char buf[64];
 	int val;
 
 	// (1)
-	btn = (CButton *)GetDlgItem(IDC_LINECOPY);
-	ts.EnableContinuedLineCopy = btn->GetCheck();
+	ts.EnableContinuedLineCopy = GetCheck(IDC_LINECOPY);
 
 	// (2)
-	btn = (CButton *)GetDlgItem(IDC_DISABLE_PASTE_RBUTTON);
-	if (btn->GetCheck()) {
+	if (GetCheck(IDC_DISABLE_PASTE_RBUTTON)) {
 		ts.PasteFlag |= CPF_DISABLE_RBUTTON;
 	}
 	else {
@@ -810,8 +537,7 @@
 	}
 
 	// (3)
-	btn = (CButton *)GetDlgItem(IDC_CONFIRM_PASTE_RBUTTON);
-	if (btn->GetCheck()) {
+	if (GetCheck(IDC_CONFIRM_PASTE_RBUTTON)) {
 		ts.PasteFlag |= CPF_CONFIRM_RBUTTON;
 	}
 	else {
@@ -819,8 +545,7 @@
 	}
 
 	// (4)
-	btn = (CButton *)GetDlgItem(IDC_DISABLE_PASTE_MBUTTON);
-	if (btn->GetCheck()) {
+	if (GetCheck(IDC_DISABLE_PASTE_MBUTTON)) {
 		ts.PasteFlag |= CPF_DISABLE_MBUTTON;
 	}
 	else {
@@ -828,12 +553,10 @@
 	}
 
 	// (5)
-	btn = (CButton *)GetDlgItem(IDC_SELECT_LBUTTON);
-	ts.SelectOnlyByLButton = btn->GetCheck();
+	ts.SelectOnlyByLButton = GetCheck(IDC_SELECT_LBUTTON);
 
 	// (6)
-	btn = (CButton *)GetDlgItem(IDC_TRIMNLCHAR);
-	if (btn->GetCheck()) {
+	if (GetCheck(IDC_TRIMNLCHAR)) {
 		ts.PasteFlag |= CPF_TRIM_TRAILING_NL;
 	}
 	else {
@@ -841,8 +564,7 @@
 	}
 
 	// (7)
-	btn = (CButton *)GetDlgItem(IDC_NORMALIZE_LINEBREAK);
-	if (btn->GetCheck()) {
+	if (GetCheck(IDC_NORMALIZE_LINEBREAK)) {
 		ts.PasteFlag |= CPF_NORMALIZE_LINEBREAK;
 	}
 	else {
@@ -850,340 +572,246 @@
 	}
 
 	// (8)IDC_CONFIRM_CHANGE_PASTE
-	btn = (CButton *)GetDlgItem(IDC_CONFIRM_CHANGE_PASTE);
-	if (btn->GetCheck()) {
+	if (GetCheck(IDC_CONFIRM_CHANGE_PASTE)) {
 		ts.PasteFlag |= CPF_CONFIRM_CHANGEPASTE;
 	}
 	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 = min(max(0, val), 5000);
+	ts.PasteDelayPerLine =
+		(val < 0) ? 0 :
+		(val > 5000) ? 5000 : val;
 }
 
 
-
 // CVisualPropPageDlg \x83_\x83C\x83A\x83\x8D\x83O
 
-IMPLEMENT_DYNAMIC(CVisualPropPageDlg, CPropertyPage)
-
-CVisualPropPageDlg::CVisualPropPageDlg()
-	: CPropertyPage(CVisualPropPageDlg::IDD)
+CVisualPropPageDlg::CVisualPropPageDlg(HINSTANCE inst, TTCPropertySheet *sheet)
+	: TTCPropertyPage(inst, CVisualPropPageDlg::IDD, sheet)
 {
-
+	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;
 }
 
 CVisualPropPageDlg::~CVisualPropPageDlg()
 {
-	if (DlgVisualFont != NULL) {
-		DeleteObject(DlgVisualFont);
-	}
+	free((void *)m_psp.pszTitle);
 }
 
-BEGIN_MESSAGE_MAP(CVisualPropPageDlg, CPropertyPage)
-END_MESSAGE_MAP()
-
 // CVisualPropPageDlg \x83\x81\x83b\x83Z\x81[\x83W \x83n\x83\x93\x83h\x83\x89
 
-BOOL CVisualPropPageDlg::OnInitDialog()
+void CVisualPropPageDlg::OnInitDialog()
 {
 	char buf[MAXPATHLEN];
-	char uimsg[MAX_UIMSG];
-	CListBox *listbox;
-	CButton *btn;
-	CComboBox *cmb;
-	int i;
 
-	CPropertyPage::OnInitDialog();
+	TTCPropertyPage::OnInitDialog();
 
-	font = (HFONT)SendMessage(WM_GETFONT, 0, 0);
-	GetObject(font, sizeof(LOGFONT), &logfont);
-	if (get_lang_font("DLG_TAHOMA_FONT", GetSafeHwnd(), &logfont, &DlgVisualFont, ts.UILanguageFile)) {
-		SendDlgItemMessage(IDC_ALPHABLEND, WM_SETFONT, (WPARAM)DlgVisualFont, MAKELPARAM(TRUE, 0));
-		SendDlgItemMessage(IDC_ALPHA_BLEND_ACTIVE, WM_SETFONT, (WPARAM)DlgVisualFont, MAKELPARAM(TRUE, 0));
-		SendDlgItemMessage(IDC_ALPHA_BLEND_INACTIVE, WM_SETFONT, (WPARAM)DlgVisualFont, MAKELPARAM(TRUE, 0));
-		SendDlgItemMessage(IDC_ALPHA_BLEND_ACTIVE_LABEL, WM_SETFONT, (WPARAM)DlgVisualFont, MAKELPARAM(TRUE, 0));
-		SendDlgItemMessage(IDC_ALPHA_BLEND_INACTIVE_LABEL, WM_SETFONT, (WPARAM)DlgVisualFont, MAKELPARAM(TRUE, 0));
-		SendDlgItemMessage(IDC_ETERM_LOOKFEEL, WM_SETFONT, (WPARAM)DlgVisualFont, MAKELPARAM(TRUE,0));
-		SendDlgItemMessage(IDC_MOUSE, WM_SETFONT, (WPARAM)DlgVisualFont, MAKELPARAM(TRUE,0));
-		SendDlgItemMessage(IDC_MOUSE_CURSOR, WM_SETFONT, (WPARAM)DlgVisualFont, MAKELPARAM(TRUE,0));
-		SendDlgItemMessage(IDC_FONT_QUALITY_LABEL, WM_SETFONT, (WPARAM)DlgVisualFont, MAKELPARAM(TRUE,0));
-		SendDlgItemMessage(IDC_FONT_QUALITY, WM_SETFONT, (WPARAM)DlgVisualFont, MAKELPARAM(TRUE,0));
-		SendDlgItemMessage(IDC_ANSICOLOR, WM_SETFONT, (WPARAM)DlgVisualFont, MAKELPARAM(TRUE,0));
-		SendDlgItemMessage(IDC_ANSI_COLOR, WM_SETFONT, (WPARAM)DlgVisualFont, MAKELPARAM(TRUE,0));
-		SendDlgItemMessage(IDC_RED, WM_SETFONT, (WPARAM)DlgVisualFont, MAKELPARAM(TRUE,0));
-		SendDlgItemMessage(IDC_COLOR_RED, WM_SETFONT, (WPARAM)DlgVisualFont, MAKELPARAM(TRUE,0));
-		SendDlgItemMessage(IDC_GREEN, WM_SETFONT, (WPARAM)DlgVisualFont, MAKELPARAM(TRUE,0));
-		SendDlgItemMessage(IDC_COLOR_GREEN, WM_SETFONT, (WPARAM)DlgVisualFont, MAKELPARAM(TRUE,0));
-		SendDlgItemMessage(IDC_BLUE, WM_SETFONT, (WPARAM)DlgVisualFont, MAKELPARAM(TRUE,0));
-		SendDlgItemMessage(IDC_COLOR_BLUE, WM_SETFONT, (WPARAM)DlgVisualFont, MAKELPARAM(TRUE,0));
-		SendDlgItemMessage(IDC_SAMPLE_COLOR, WM_SETFONT, (WPARAM)DlgVisualFont, MAKELPARAM(TRUE,0));
-		SendDlgItemMessage(IDC_ENABLE_ATTR_COLOR_BOLD, WM_SETFONT, (WPARAM)DlgVisualFont, MAKELPARAM(TRUE,0));
-		SendDlgItemMessage(IDC_ENABLE_ATTR_COLOR_BLINK, WM_SETFONT, (WPARAM)DlgVisualFont, MAKELPARAM(TRUE,0));
-		SendDlgItemMessage(IDC_ENABLE_ATTR_COLOR_REVERSE, WM_SETFONT, (WPARAM)DlgVisualFont, MAKELPARAM(TRUE,0));
-		SendDlgItemMessage(IDC_ENABLE_URL_COLOR, WM_SETFONT, (WPARAM)DlgVisualFont, MAKELPARAM(TRUE,0));
-		SendDlgItemMessage(IDC_ENABLE_ANSI_COLOR, WM_SETFONT, (WPARAM)DlgVisualFont, MAKELPARAM(TRUE,0));
-		SendDlgItemMessage(IDC_URL_UNDERLINE, WM_SETFONT, (WPARAM)DlgVisualFont, MAKELPARAM(TRUE,0));
-		SendDlgItemMessage(IDC_BGIMG_CHECK, WM_SETFONT, (WPARAM)DlgVisualFont, MAKELPARAM(TRUE,0));
-		SendDlgItemMessage(IDC_BGIMG_EDIT, WM_SETFONT, (WPARAM)DlgVisualFont, MAKELPARAM(TRUE,0));
-		SendDlgItemMessage(IDC_BGIMG_BUTTON, WM_SETFONT, (WPARAM)DlgVisualFont, MAKELPARAM(TRUE,0));
-		SendDlgItemMessage(IDC_RESTART, WM_SETFONT, (WPARAM)DlgVisualFont, MAKELPARAM(TRUE,0));
-		SendDlgItemMessage(IDC_BGIMG_BRIGHTNESS, WM_SETFONT, (WPARAM)DlgVisualFont, MAKELPARAM(TRUE, 0));
-		SendDlgItemMessage(IDC_EDIT_BGIMG_BRIGHTNESS, WM_SETFONT, (WPARAM)DlgVisualFont, MAKELPARAM(TRUE, 0));
-	}
-	else {
-		DlgVisualFont = NULL;
-	}
+	static const DlgTextInfo TextInfos[] = {
+		{ IDC_ALPHABLEND, "DLG_TAB_VISUAL_ALPHA" },
+		{ IDC_ALPHA_BLEND_ACTIVE_LABEL, "DLG_TAB_VISUAL_ALPHA_ACTIVE_LABEL" },
+		{ IDC_ALPHA_BLEND_INACTIVE_LABEL, "DLG_TAB_VISUAL_ALPHA_INACTIVE_LABEL" },
+		{ IDC_ETERM_LOOKFEEL, "DLG_TAB_VISUAL_ETERM" },
+		{ IDC_BGIMG_CHECK, "DLG_TAB_VISUAL_BGIMG" },
+		{ IDC_BGIMG_BRIGHTNESS, "DLG_TAB_VISUAL_BGIMG_BRIGHTNESS" },
+		{ IDC_MOUSE, "DLG_TAB_VISUAL_MOUSE" },
+		{ IDC_FONT_QUALITY_LABEL, "DLG_TAB_VISUAL_FONT_QUALITY" },
+		{ IDC_ANSICOLOR, "DLG_TAB_VISUAL_ANSICOLOR" },
+		{ IDC_RED, "DLG_TAB_VISUAL_RED" },
+		{ IDC_GREEN, "DLG_TAB_VISUAL_GREEN" },
+		{ IDC_BLUE, "DLG_TAB_VISUAL_BLUE" },
+		{ IDC_ENABLE_ATTR_COLOR_BOLD, "DLG_TAB_VISUAL_BOLD" },
+		{ IDC_ENABLE_ATTR_COLOR_BLINK, "DLG_TAB_VISUAL_BLINK" },
+		{ IDC_ENABLE_ATTR_COLOR_REVERSE, "DLG_TAB_VISUAL_REVERSE" },
+		{ IDC_ENABLE_URL_COLOR, "DLG_TAB_VISUAL_URL" },
+		{ IDC_ENABLE_ANSI_COLOR, "DLG_TAB_VISUAL_ANSI" },
+		{ IDC_URL_UNDERLINE, "DLG_TAB_VISUAL_URLUL" },
+		{ IDC_RESTART, "DLG_TAB_VISUAL_RESTART" },
+	};
+	SetDlgTexts(m_hWnd, TextInfos, _countof(TextInfos), ts.UILanguageFile);
 
-	GetDlgItemText(IDC_ALPHABLEND, uimsg, sizeof(uimsg));
-	get_lang_msg("DLG_TAB_VISUAL_ALPHA", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
-	SetDlgItemText(IDC_ALPHABLEND, ts.UIMsg);
-	GetDlgItemText(IDC_ALPHA_BLEND_ACTIVE_LABEL, uimsg, sizeof(uimsg));
-	get_lang_msg("DLG_TAB_VISUAL_ALPHA_ACTIVE", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
-	SetDlgItemText(IDC_ALPHA_BLEND_ACTIVE_LABEL, ts.UIMsg);
-	GetDlgItemText(IDC_ALPHA_BLEND_INACTIVE_LABEL, uimsg, sizeof(uimsg));
-	get_lang_msg("DLG_TAB_VISUAL_ALPHA_INACTIVE", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
-	SetDlgItemText(IDC_ALPHA_BLEND_INACTIVE_LABEL, ts.UIMsg);
-	GetDlgItemText(IDC_ETERM_LOOKFEEL, uimsg, sizeof(uimsg));
-	get_lang_msg("DLG_TAB_VISUAL_ETERM", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
-	SetDlgItemText(IDC_ETERM_LOOKFEEL, ts.UIMsg);
-	GetDlgItemText(IDC_BGIMG_CHECK, uimsg, sizeof(uimsg));
-	get_lang_msg("DLG_TAB_VISUAL_BGIMG", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
-	SetDlgItemText(IDC_BGIMG_CHECK, ts.UIMsg);
-	GetDlgItemText(IDC_BGIMG_BRIGHTNESS, uimsg, sizeof(uimsg));
-	get_lang_msg("DLG_TAB_VISUAL_BGIMG_BRIGHTNESS", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
-	SetDlgItemText(IDC_BGIMG_BRIGHTNESS, ts.UIMsg);
-	GetDlgItemText(IDC_MOUSE, uimsg, sizeof(uimsg));
-	get_lang_msg("DLG_TAB_VISUAL_MOUSE", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
-	SetDlgItemText(IDC_MOUSE, ts.UIMsg);
-	GetDlgItemText(IDC_FONT_QUALITY_LABEL, uimsg, sizeof(uimsg));
-	get_lang_msg("DLG_TAB_VISUAL_FONT_QUALITY", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
-	SetDlgItemText(IDC_FONT_QUALITY_LABEL, ts.UIMsg);
-	GetDlgItemText(IDC_ANSICOLOR, uimsg, sizeof(uimsg));
-	get_lang_msg("DLG_TAB_VISUAL_ANSICOLOR", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
-	SetDlgItemText(IDC_ANSICOLOR, ts.UIMsg);
-	GetDlgItemText(IDC_RED, uimsg, sizeof(uimsg));
-	get_lang_msg("DLG_TAB_VISUAL_RED", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
-	SetDlgItemText(IDC_RED, ts.UIMsg);
-	GetDlgItemText(IDC_GREEN, uimsg, sizeof(uimsg));
-	get_lang_msg("DLG_TAB_VISUAL_GREEN", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
-	SetDlgItemText(IDC_GREEN, ts.UIMsg);
-	GetDlgItemText(IDC_BLUE, uimsg, sizeof(uimsg));
-	get_lang_msg("DLG_TAB_VISUAL_BLUE", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
-	SetDlgItemText(IDC_BLUE, ts.UIMsg);
-	GetDlgItemText(IDC_ENABLE_ATTR_COLOR_BOLD, uimsg, sizeof(uimsg));
-	get_lang_msg("DLG_TAB_VISUAL_BOLD", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
-	SetDlgItemText(IDC_ENABLE_ATTR_COLOR_BOLD, ts.UIMsg);
-	GetDlgItemText(IDC_ENABLE_ATTR_COLOR_BLINK, uimsg, sizeof(uimsg));
-	get_lang_msg("DLG_TAB_VISUAL_BLINK", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
-	SetDlgItemText(IDC_ENABLE_ATTR_COLOR_BLINK, ts.UIMsg);
-	GetDlgItemText(IDC_ENABLE_ATTR_COLOR_REVERSE, uimsg, sizeof(uimsg));
-	get_lang_msg("DLG_TAB_VISUAL_REVERSE", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
-	SetDlgItemText(IDC_ENABLE_ATTR_COLOR_REVERSE, ts.UIMsg);
-	GetDlgItemText(IDC_ENABLE_URL_COLOR, uimsg, sizeof(uimsg));
-	get_lang_msg("DLG_TAB_VISUAL_URL", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
-	SetDlgItemText(IDC_ENABLE_URL_COLOR, ts.UIMsg);
-	GetDlgItemText(IDC_ENABLE_ANSI_COLOR, uimsg, sizeof(uimsg));
-	get_lang_msg("DLG_TAB_VISUAL_ANSI", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
-	SetDlgItemText(IDC_ENABLE_ANSI_COLOR, ts.UIMsg);
-	GetDlgItemText(IDC_URL_UNDERLINE, uimsg, sizeof(uimsg));
-	get_lang_msg("DLG_TAB_VISUAL_URLUL", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
-	SetDlgItemText(IDC_URL_UNDERLINE, ts.UIMsg);
-	GetDlgItemText(IDC_RESTART, uimsg, sizeof(uimsg));
-	get_lang_msg("DLG_TAB_VISUAL_RESTART", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
-	SetDlgItemText(IDC_RESTART, ts.UIMsg);
+	TCHAR uimsg[MAX_UIMSG];
+	get_lang_msgT("DLG_TAB_VISUAL_FONT_QUALITY_DEFAULT",
+				  uimsg, _countof(uimsg), _T("Default"), ts.UILanguageFile);
+	SendDlgItemMessage(IDC_FONT_QUALITY, CB_ADDSTRING, 0, (LPARAM)uimsg);
+	get_lang_msgT("DLG_TAB_VISUAL_FONT_QUALITY_NONANTIALIASED",
+				  uimsg, _countof(uimsg), _T("Non-Antialiased"), ts.UILanguageFile);
+	SendDlgItemMessage(IDC_FONT_QUALITY, CB_ADDSTRING, 0, (LPARAM)uimsg);
+	get_lang_msgT("DLG_TAB_VISUAL_FONT_QUALITY_ANTIALIASED",
+				  uimsg, _countof(uimsg), _T("Antialiased"), ts.UILanguageFile);
+	SendDlgItemMessage(IDC_FONT_QUALITY, CB_ADDSTRING, 0, (LPARAM)uimsg);
+	get_lang_msgT("DLG_TAB_VISUAL_FONT_QUALITY_CLEARTYPE",
+				  uimsg, _countof(uimsg), _T("ClearType"), ts.UILanguageFile);
+	SendDlgItemMessage(IDC_FONT_QUALITY, CB_ADDSTRING, 0, (LPARAM)uimsg);
 
-	get_lang_msg("DLG_TAB_VISUAL_FONT_QUALITY_DEFAULT", ts.UIMsg, sizeof(ts.UIMsg), "Default", ts.UILanguageFile);
-	SendDlgItemMessage(IDC_FONT_QUALITY, CB_ADDSTRING, 0, (LPARAM)ts.UIMsg);
-	get_lang_msg("DLG_TAB_VISUAL_FONT_QUALITY_NONANTIALIASED", ts.UIMsg, sizeof(ts.UIMsg), "Non-Antialiased", ts.UILanguageFile);
-	SendDlgItemMessage(IDC_FONT_QUALITY, CB_ADDSTRING, 0, (LPARAM)ts.UIMsg);
-	get_lang_msg("DLG_TAB_VISUAL_FONT_QUALITY_ANTIALIASED", ts.UIMsg, sizeof(ts.UIMsg), "Antialiased", ts.UILanguageFile);
-	SendDlgItemMessage(IDC_FONT_QUALITY, CB_ADDSTRING, 0, (LPARAM)ts.UIMsg);
-	get_lang_msg("DLG_TAB_VISUAL_FONT_QUALITY_CLEARTYPE", ts.UIMsg, sizeof(ts.UIMsg), "ClearType", ts.UILanguageFile);
-	SendDlgItemMessage(IDC_FONT_QUALITY, CB_ADDSTRING, 0, (LPARAM)ts.UIMsg);
-
 	// (1)AlphaBlend
-	_snprintf_s(buf, sizeof(buf), _TRUNCATE, "%d", ts.AlphaBlendActive);
-	SetDlgItemText(IDC_ALPHA_BLEND_ACTIVE, buf);
-	_snprintf_s(buf, sizeof(buf), _TRUNCATE, "%d", ts.AlphaBlendInactive);
-	SetDlgItemText(IDC_ALPHA_BLEND_INACTIVE, buf);
 
+	SetDlgItemNum(IDC_ALPHA_BLEND_ACTIVE, ts.AlphaBlendActive);
+
+	SetDlgItemNum(IDC_ALPHA_BLEND_INACTIVE, ts.AlphaBlendInactive);
+
 	// (2)[BG] BGEnable
-	btn = (CButton *)GetDlgItem(IDC_ETERM_LOOKFEEL);
-	btn->SetCheck(ts.EtermLookfeel.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) {
-		GetDlgItem(IDC_BGIMG_CHECK)->EnableWindow(TRUE);
+		EnableDlgItem(IDC_BGIMG_CHECK, TRUE);
 
-		btn = (CButton *)GetDlgItem(IDC_BGIMG_CHECK);
 		if (strcmp(ts.EtermLookfeel.BGThemeFile, BG_THEME_IMAGEFILE) == 0) {
-			btn->SetCheck(BST_CHECKED);
-			GetDlgItem(IDC_BGIMG_EDIT)->EnableWindow(TRUE);
-			GetDlgItem(IDC_BGIMG_BUTTON)->EnableWindow(TRUE);
+			SetCheck(IDC_BGIMG_CHECK, BST_CHECKED);
+			EnableDlgItem(IDC_BGIMG_EDIT, TRUE);
+			EnableDlgItem(IDC_BGIMG_BUTTON, TRUE);
 
-			GetDlgItem(IDC_BGIMG_BRIGHTNESS)->EnableWindow(TRUE);
-			GetDlgItem(IDC_EDIT_BGIMG_BRIGHTNESS)->EnableWindow(TRUE);
+			EnableDlgItem(IDC_BGIMG_BRIGHTNESS, TRUE);
+			EnableDlgItem(IDC_EDIT_BGIMG_BRIGHTNESS, TRUE);
 		} else {
-			btn->SetCheck(BST_UNCHECKED);
-			GetDlgItem(IDC_BGIMG_EDIT)->EnableWindow(FALSE);
-			GetDlgItem(IDC_BGIMG_BUTTON)->EnableWindow(FALSE);
+			SetCheck(IDC_BGIMG_CHECK, BST_UNCHECKED);
+			EnableDlgItem(IDC_BGIMG_EDIT, FALSE);
+			EnableDlgItem(IDC_BGIMG_BUTTON, FALSE);
 
-			GetDlgItem(IDC_BGIMG_BRIGHTNESS)->EnableWindow(FALSE);
-			GetDlgItem(IDC_EDIT_BGIMG_BRIGHTNESS)->EnableWindow(FALSE);
+			EnableDlgItem(IDC_BGIMG_BRIGHTNESS, FALSE);
+			EnableDlgItem(IDC_EDIT_BGIMG_BRIGHTNESS, FALSE);
 		}
 	} else {
-		GetDlgItem(IDC_BGIMG_CHECK)->EnableWindow(FALSE);
-		GetDlgItem(IDC_BGIMG_EDIT)->EnableWindow(FALSE);
-		GetDlgItem(IDC_BGIMG_BUTTON)->EnableWindow(FALSE);
+		EnableDlgItem(IDC_BGIMG_CHECK, FALSE);
+		EnableDlgItem(IDC_BGIMG_EDIT, FALSE);
+		EnableDlgItem(IDC_BGIMG_BUTTON, FALSE);
 
-		GetDlgItem(IDC_BGIMG_BRIGHTNESS)->EnableWindow(FALSE);
-		GetDlgItem(IDC_EDIT_BGIMG_BRIGHTNESS)->EnableWindow(FALSE);
+		EnableDlgItem(IDC_BGIMG_BRIGHTNESS, FALSE);
+		EnableDlgItem(IDC_EDIT_BGIMG_BRIGHTNESS, FALSE);
 	}
 
 	// (3)Mouse cursor type
-	cmb = (CComboBox *)GetDlgItem(IDC_MOUSE_CURSOR);
-	for (i = 0 ; MouseCursor[i].name ; i++) {
-		cmb->InsertString(i, MouseCursor[i].name);
+	int sel = 0;
+	for (int i = 0 ; MouseCursor[i].name ; i++) {
+		const char *name = MouseCursor[i].name;
+		SendDlgItemMessageA(IDC_MOUSE_CURSOR, CB_ADDSTRING, i, (LPARAM)name);
+		if (strcmp(name, ts.MouseCursorName) == 0) {
+			sel = i;
+		}
 	}
-	cmb->SelectString(0, ts.MouseCursorName);
+	SetCurSel(IDC_MOUSE_CURSOR, sel);
 
 	// (4)Font quality
-	cmb = (CComboBox *)GetDlgItem(IDC_FONT_QUALITY);
 	switch (ts.FontQuality) {
 		case DEFAULT_QUALITY:
-			cmb->SetCurSel(0);
+			SetCurSel(IDC_FONT_QUALITY, 0);
 			break;
 		case NONANTIALIASED_QUALITY:
-			cmb->SetCurSel(1);
+			SetCurSel(IDC_FONT_QUALITY, 1);
 			break;
 		case ANTIALIASED_QUALITY:
-			cmb->SetCurSel(2);
+			SetCurSel(IDC_FONT_QUALITY, 2);
 			break;
 		default: // CLEARTYPE_QUALITY
-			cmb->SetCurSel(3);
+			SetCurSel(IDC_FONT_QUALITY, 3);
 			break;
 	}
 
 	// (5)ANSI color
-	listbox = (CListBox *)GetDlgItem(IDC_ANSI_COLOR);
-	for (i = 0 ; i < 16 ; i++) {
+	for (int i = 0 ; i < 16 ; i++) {
 		_snprintf_s(buf, sizeof(buf), _TRUNCATE, "%d", i);
-		listbox->InsertString(i, buf);
+		SendDlgItemMessageA(IDC_ANSI_COLOR, LB_INSERTSTRING, i, (LPARAM)buf);
 	}
-	SetupRGBbox(GetSafeHwnd(), 0);
-#if 0
-	SendMessage(WM_CTLCOLORSTATIC,
-	            (WPARAM)label_hdc,
-	            (LPARAM)GetDlgItem(IDC_SAMPLE_COLOR));
-#endif
+	SetupRGBbox(0);
+	SendDlgItemMessage(IDC_ANSI_COLOR, LB_SETCURSEL, 0, 0);
+	::InvalidateRect(GetDlgItem(IDC_SAMPLE_COLOR), NULL, TRUE);
 
 	// (6)Bold Attr Color
-	btn = (CButton *)GetDlgItem(IDC_ENABLE_ATTR_COLOR_BOLD);
-	btn->SetCheck((ts.ColorFlag&CF_BOLDCOLOR) != 0);
+	SetCheck(IDC_ENABLE_ATTR_COLOR_BOLD, (ts.ColorFlag&CF_BOLDCOLOR) != 0);
 
 	// (7)Blink Attr Color
-	btn = (CButton *)GetDlgItem(IDC_ENABLE_ATTR_COLOR_BLINK);
-	btn->SetCheck((ts.ColorFlag&CF_BLINKCOLOR) != 0);
+	SetCheck(IDC_ENABLE_ATTR_COLOR_BLINK, (ts.ColorFlag&CF_BLINKCOLOR) != 0);
 
 	// (8)Reverse Attr Color
-	btn = (CButton *)GetDlgItem(IDC_ENABLE_ATTR_COLOR_REVERSE);
-	btn->SetCheck((ts.ColorFlag&CF_REVERSECOLOR) != 0);
+	SetCheck(IDC_ENABLE_ATTR_COLOR_REVERSE, (ts.ColorFlag&CF_REVERSECOLOR) != 0);
 
 	// (9)URL Color
-	btn = (CButton *)GetDlgItem(IDC_ENABLE_URL_COLOR);
-	btn->SetCheck((ts.ColorFlag&CF_URLCOLOR) != 0);
+	SetCheck(IDC_ENABLE_URL_COLOR, (ts.ColorFlag&CF_URLCOLOR) != 0);
 
 	// (10)Color
-	btn = (CButton *)GetDlgItem(IDC_ENABLE_ANSI_COLOR);
-	btn->SetCheck((ts.ColorFlag&CF_ANSICOLOR) != 0);
+	SetCheck(IDC_ENABLE_ANSI_COLOR, (ts.ColorFlag&CF_ANSICOLOR) != 0);
 
 	// (11)URL Underline
-	btn = (CButton *)GetDlgItem(IDC_URL_UNDERLINE);
-	btn->SetCheck((ts.FontFlag&FF_URLUNDERLINE) != 0);
+	SetCheck(IDC_URL_UNDERLINE, (ts.FontFlag&FF_URLUNDERLINE) != 0);
 
 	// \x83_\x83C\x83A\x83\x8D\x83O\x82Ƀt\x83H\x81[\x83J\x83X\x82𓖂Ă\xE9
-	::SetFocus(::GetDlgItem(GetSafeHwnd(), IDC_ALPHA_BLEND_ACTIVE));
-
-	return FALSE;
+	::SetFocus(GetDlgItem(IDC_ALPHA_BLEND_ACTIVE));
 }
 
 BOOL CVisualPropPageDlg::OnCommand(WPARAM wParam, LPARAM lParam)
 {
-	CListBox *listbox;
 	int sel;
-	char buf[MAXPATHLEN];
-	CButton *btn;
 
 	switch (wParam) {
-		case IDC_ETERM_LOOKFEEL:
+	case IDC_ETERM_LOOKFEEL:
 			// \x83`\x83F\x83b\x83N\x82\xB3\x82ꂽ\x82\xE7 Enable/Disable \x82\xF0\x83g\x83O\x83\x8B\x82\xB7\x82\xE9\x81B
-			btn = (CButton *)GetDlgItem(IDC_ETERM_LOOKFEEL);
-			if (btn->GetCheck()) {
-				GetDlgItem(IDC_BGIMG_CHECK)->EnableWindow(TRUE);
-				btn = (CButton *)GetDlgItem(IDC_BGIMG_CHECK);
-				if (btn->GetCheck()) {
-					GetDlgItem(IDC_BGIMG_EDIT)->EnableWindow(TRUE);
-					GetDlgItem(IDC_BGIMG_BUTTON)->EnableWindow(TRUE);
+			if (GetCheck(IDC_ETERM_LOOKFEEL)) {
+				EnableDlgItem(IDC_BGIMG_CHECK, TRUE);
+				if (GetCheck(IDC_BGIMG_CHECK)) {
+					EnableDlgItem(IDC_BGIMG_EDIT, TRUE);
+					EnableDlgItem(IDC_BGIMG_BUTTON, TRUE);
 
-					GetDlgItem(IDC_BGIMG_BRIGHTNESS)->EnableWindow(TRUE);
-					GetDlgItem(IDC_EDIT_BGIMG_BRIGHTNESS)->EnableWindow(TRUE);
+					EnableDlgItem(IDC_BGIMG_BRIGHTNESS, TRUE);
+					EnableDlgItem(IDC_EDIT_BGIMG_BRIGHTNESS, TRUE);
 				} else {
-					GetDlgItem(IDC_BGIMG_EDIT)->EnableWindow(FALSE);
-					GetDlgItem(IDC_BGIMG_BUTTON)->EnableWindow(FALSE);
+					EnableDlgItem(IDC_BGIMG_EDIT, FALSE);
+					EnableDlgItem(IDC_BGIMG_BUTTON, FALSE);
 
-					GetDlgItem(IDC_BGIMG_BRIGHTNESS)->EnableWindow(FALSE);
-					GetDlgItem(IDC_EDIT_BGIMG_BRIGHTNESS)->EnableWindow(FALSE);
+					EnableDlgItem(IDC_BGIMG_BRIGHTNESS, FALSE);
+					EnableDlgItem(IDC_EDIT_BGIMG_BRIGHTNESS, FALSE);
 				}
 			} else {
-				GetDlgItem(IDC_BGIMG_CHECK)->EnableWindow(FALSE);
-				GetDlgItem(IDC_BGIMG_EDIT)->EnableWindow(FALSE);
-				GetDlgItem(IDC_BGIMG_BUTTON)->EnableWindow(FALSE);
+				EnableDlgItem(IDC_BGIMG_CHECK, FALSE);
+				EnableDlgItem(IDC_BGIMG_EDIT, FALSE);
+				EnableDlgItem(IDC_BGIMG_BUTTON, FALSE);
 
-				GetDlgItem(IDC_BGIMG_BRIGHTNESS)->EnableWindow(FALSE);
-				GetDlgItem(IDC_EDIT_BGIMG_BRIGHTNESS)->EnableWindow(FALSE);
+				EnableDlgItem(IDC_BGIMG_BRIGHTNESS, FALSE);
+				EnableDlgItem(IDC_EDIT_BGIMG_BRIGHTNESS, FALSE);
 
 				// \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;
 
 		case IDC_BGIMG_CHECK:
-			btn = (CButton *)GetDlgItem(IDC_BGIMG_CHECK);
-			if (btn->GetCheck()) {
-				GetDlgItem(IDC_BGIMG_EDIT)->EnableWindow(TRUE);
-				GetDlgItem(IDC_BGIMG_BUTTON)->EnableWindow(TRUE);
+			if (GetCheck(IDC_BGIMG_CHECK)) {
+				EnableDlgItem(IDC_BGIMG_EDIT, TRUE);
+				EnableDlgItem(IDC_BGIMG_BUTTON, TRUE);
 
-				GetDlgItem(IDC_BGIMG_BRIGHTNESS)->EnableWindow(TRUE);
-				GetDlgItem(IDC_EDIT_BGIMG_BRIGHTNESS)->EnableWindow(TRUE);
+				EnableDlgItem(IDC_BGIMG_BRIGHTNESS, TRUE);
+				EnableDlgItem(IDC_EDIT_BGIMG_BRIGHTNESS, TRUE);
 
 				strncpy_s(ts.EtermLookfeel.BGThemeFile, BG_THEME_IMAGEFILE, sizeof(ts.EtermLookfeel.BGThemeFile));
 			} else {
-				GetDlgItem(IDC_BGIMG_EDIT)->EnableWindow(FALSE);
-				GetDlgItem(IDC_BGIMG_BUTTON)->EnableWindow(FALSE);
+				EnableDlgItem(IDC_BGIMG_EDIT, FALSE);
+				EnableDlgItem(IDC_BGIMG_BUTTON, FALSE);
 
-				GetDlgItem(IDC_BGIMG_BRIGHTNESS)->EnableWindow(FALSE);
-				GetDlgItem(IDC_EDIT_BGIMG_BRIGHTNESS)->EnableWindow(FALSE);
+				EnableDlgItem(IDC_BGIMG_BRIGHTNESS, FALSE);
+				EnableDlgItem(IDC_EDIT_BGIMG_BRIGHTNESS, FALSE);
 
 				// \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;
@@ -1191,25 +819,29 @@
 		case IDC_BGIMG_BUTTON | (BN_CLICKED << 16):
 			// \x94w\x8Ci\x89摜\x82\xF0\x83_\x83C\x83A\x83\x8D\x83O\x82Ŏw\x92肷\x82\xE9\x81B
 			{
-				CString         filter("Image Files(*.jpg;*.jpeg;*.bmp)|*.jpg;*.jpeg;*.bmp|All Files(*.*)|*.*||");
-				CFileDialog     selDlg(TRUE, NULL, NULL, OFN_HIDEREADONLY, filter);
-				if (selDlg.DoModal() == IDOK) {
-					// \x94w\x8Ci\x89摜\x8Ew\x92肪\x88Ӑ}\x93I\x82ɍs\x82\xED\x82ꂽ\x82\xE7\x81ABGThemeFile \x82\xF0\x8CŒ艻\x82\xB7\x82\xE9\x81B
-					SetDlgItemText(IDC_BGIMG_EDIT, selDlg.GetPathName());
+				OPENFILENAMEA ofn;
+				char szFile[MAX_PATH];
+
+				memset(&ofn, 0, sizeof(ofn));
+				memset(szFile, 0, sizeof(szFile));
+				ofn.lStructSize = get_OPENFILENAME_SIZEA();
+				ofn.hwndOwner = m_pSheet->m_hWnd;
+				ofn.lpstrFilter = "Image Files(*.jpg;*.jpeg;*.bmp)\0*.jpg;*.jpeg;*.bmp\0All Files(*.*)\0*.*\0";
+				ofn.lpstrFile = szFile;
+				ofn.nMaxFile = _countof(szFile);
+				ofn.lpstrTitle = "select image file";
+				ofn.Flags = OFN_FILEMUSTEXIST | OFN_HIDEREADONLY;
+				if (GetOpenFileNameA(&ofn) != 0) {
+					SetDlgItemTextA(IDC_BGIMG_EDIT, szFile);
 				}
 			}
 			return TRUE;
 
 		case IDC_ANSI_COLOR | (LBN_SELCHANGE << 16):
-			listbox = (CListBox *)GetDlgItem(IDC_ANSI_COLOR);
-			sel = listbox->GetCurSel();
+			sel = SendDlgItemMessage(IDC_ANSI_COLOR, LB_GETCURSEL, 0, 0);
 			if (sel != -1) {
-				SetupRGBbox(GetSafeHwnd(), sel);
-#if 0
-				SendMessage(WM_CTLCOLORSTATIC,
-				            (WPARAM)label_hdc,
-				            (LPARAM)GetDlgItem(IDC_SAMPLE_COLOR));
-#endif
+				SetupRGBbox(sel);
+				::InvalidateRect(GetDlgItem(IDC_SAMPLE_COLOR), NULL, TRUE);
 			}
 			return TRUE;
 
@@ -1218,81 +850,61 @@
 		case IDC_COLOR_BLUE | (EN_KILLFOCUS << 16):
 			{
 				BYTE r, g, b;
+				char buf[8];
 
-				listbox = (CListBox *)GetDlgItem(IDC_ANSI_COLOR);
-				sel = listbox->GetCurSel();
+				sel = GetCurSel(IDC_ANSI_COLOR);
 				if (sel < 0 && sel > sizeof(ts.ANSIColor)-1) {
 					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);
-#if 0
-				SendMessage(WM_CTLCOLORSTATIC,
-				            (WPARAM)label_hdc,
-				            (LPARAM)GetDlgItem(IDC_SAMPLE_COLOR));
-#endif
+				SetupRGBbox(sel);
+
+				::InvalidateRect(GetDlgItem(IDC_SAMPLE_COLOR), NULL, TRUE);
 			}
 
 			return TRUE;
-#if 0
-		case WM_CTLCOLORSTATIC:
-			{
-				HDC hDC = (HDC)wp;
-				HWND hWnd = (HWND)lp;
+	}
 
-				//if (label_hdc == NULL) {
-					hDC = GetWindowDC(GetDlgItem(hDlgWnd, IDC_SAMPLE_COLOR));
-				//	label_hdc = hDC;
-				//}
+	return TTCPropertyPage::OnCommand(wParam, lParam);
+}
 
-				if ( hWnd == GetDlgItem(hDlgWnd, IDC_SAMPLE_COLOR) ) {
-					BYTE r, g, b;
+HBRUSH CVisualPropPageDlg::OnCtlColor(HDC hDC, HWND hWnd)
+{
+	if ( hWnd == GetDlgItem(IDC_SAMPLE_COLOR) ) {
+		BYTE r, g, b;
+		char buf[8];
 
-					hWnd = GetDlgItem(hDlgWnd, IDC_COLOR_RED);
-					SendMessage(hWnd, WM_GETTEXT , sizeof(buf), (LPARAM)buf);
-					r = atoi(buf);
+		GetDlgItemTextA(IDC_COLOR_RED, buf, sizeof(buf));
+		r = atoi(buf);
 
-					hWnd = GetDlgItem(hDlgWnd, IDC_COLOR_GREEN);
-					SendMessage(hWnd, WM_GETTEXT , sizeof(buf), (LPARAM)buf);
-					g = atoi(buf);
+		GetDlgItemTextA(IDC_COLOR_GREEN, buf, sizeof(buf));
+		g = atoi(buf);
 
-					hWnd = GetDlgItem(hDlgWnd, IDC_COLOR_BLUE);
-					SendMessage(hWnd, WM_GETTEXT , sizeof(buf), (LPARAM)buf);
-					b = atoi(buf);
+		GetDlgItemTextA(IDC_COLOR_BLUE, buf, sizeof(buf));
+		b = atoi(buf);
 
-					OutputDebugPrintf("%06x\n", RGB(r, g, b));
+		SetBkMode(hDC, TRANSPARENT);
+		SetTextColor(hDC, RGB(r, g, b) );
 
-					SetBkMode(hDC, TRANSPARENT);
-					SetTextColor(hDC, RGB(r, g, b) );
-					ReleaseDC(hDlgWnd, hDC);
-
-					return (BOOL)(HBRUSH)GetStockObject(NULL_BRUSH);
-				}
-				return FALSE;
-			}
-			break ;
-#endif
+		return (HBRUSH)GetStockObject(NULL_BRUSH);
 	}
-
-	return CPropertyPage::OnCommand(wParam, lParam);
+	return TTCPropertyPage::OnCtlColor(hDC, hWnd);
 }
 
 void CVisualPropPageDlg::OnOK()
 {
-	CButton *btn;
-	CComboBox *cmb;
 	int sel;
 	char buf[MAXPATHLEN];
 	COLORREF TmpColor;
@@ -1299,7 +911,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 =
@@ -1306,10 +918,10 @@
 			(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 =
+		ts.AlphaBlendInactive = 
 			(i < 0) ? 0 :
 			(i > 255) ? 255 : i;
 	}
@@ -1317,35 +929,32 @@
 	// (2)
 	// \x83O\x83\x8D\x81[\x83o\x83\x8B\x95ϐ\x94 BGEnable \x82𒼐ڏ\x91\x82\xAB\x8A\xB7\x82\xA6\x82\xE9\x82ƁA\x83v\x83\x8D\x83O\x83\x89\x83\x80\x82\xAA\x97\x8E\x82\xBF\x82邱\x82Ƃ\xAA
 	// \x82\xA0\x82\xE9\x82̂ŃR\x83s\x81[\x82\xF0\x8FC\x90\xB3\x82\xB7\x82\xE9\x82݂̂Ƃ\xB7\x82\xE9\x81B(2005.4.24 yutaka)
-	btn = (CButton *)GetDlgItem(IDC_ETERM_LOOKFEEL);
-	if (ts.EtermLookfeel.BGEnable != btn->GetCheck()) {
+	if (ts.EtermLookfeel.BGEnable != GetCheck(IDC_ETERM_LOOKFEEL)) {
 		flag_changed = 1;
-		ts.EtermLookfeel.BGEnable = btn->GetCheck();
+		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])) {
-		ts.BGImgBrightness = atoi(buf);
-		ts.BGImgBrightness = max(0, ts.BGImgBrightness);
-		ts.BGImgBrightness = min(255, ts.BGImgBrightness);
+		int i = atoi(buf);
+		ts.BGImgBrightness = 
+			(i < 0) ? 0 :
+			(i > 255) ? 255 : i;
 	}
 
 	// (3)
-	cmb = (CComboBox *)GetDlgItem(IDC_MOUSE_CURSOR);
-	sel = cmb->GetCurSel();
+	sel = GetCurSel(IDC_MOUSE_CURSOR);
 	if (sel >= 0 && sel < MOUSE_CURSOR_MAX) {
 		strncpy_s(ts.MouseCursorName, sizeof(ts.MouseCursorName), MouseCursor[sel].name, _TRUNCATE);
 	}
 
 	// (4)Font quality
-	cmb = (CComboBox *)GetDlgItem(IDC_FONT_QUALITY);
-	switch (cmb->GetCurSel()) {
+	switch (GetCurSel(IDC_FONT_QUALITY)) {
 		case 0:
 			ts.FontQuality = DEFAULT_QUALITY;
 			break;
@@ -1363,22 +972,19 @@
 	}
 
 	// (6) Attr Bold Color
-	btn = (CButton *)GetDlgItem(IDC_ENABLE_ATTR_COLOR_BOLD);
-	if (((ts.ColorFlag & CF_BOLDCOLOR) != 0) != btn->GetCheck()) {
+	if (((ts.ColorFlag & CF_BOLDCOLOR) != 0) != GetCheck(IDC_ENABLE_ATTR_COLOR_BOLD)) {
 		ts.ColorFlag ^= CF_BOLDCOLOR;
 	}
 
 	// (7) Attr Blink Color
-	btn = (CButton *)GetDlgItem(IDC_ENABLE_ATTR_COLOR_BLINK);
-	if (((ts.ColorFlag & CF_BLINKCOLOR) != 0) != btn->GetCheck()) {
+	if (((ts.ColorFlag & CF_BLINKCOLOR) != 0) != GetCheck(IDC_ENABLE_ATTR_COLOR_BLINK)) {
 		ts.ColorFlag ^= CF_BLINKCOLOR;
 	}
 
 	// (8) Attr Reverse Color
-	btn = (CButton *)GetDlgItem(IDC_ENABLE_ATTR_COLOR_REVERSE);
 	if (ts.ColorFlag & CF_REVERSEVIDEO) { // Reverse Video\x83\x82\x81[\x83h(DECSCNM)\x8E\x9E\x82͏\x88\x97\x9D\x82\xF0\x95ς\xA6\x82\xE9
 		if (ts.ColorFlag & CF_REVERSECOLOR) {
-			if (!btn->GetCheck()) {
+			if (!GetCheck(IDC_ENABLE_ATTR_COLOR_REVERSE)) {
 				TmpColor = ts.VTColor[0];
 				ts.VTColor[0] = ts.VTReverseColor[1];
 				ts.VTReverseColor[1] = ts.VTColor[1];
@@ -1387,7 +993,7 @@
 				ts.ColorFlag ^= CF_REVERSECOLOR;
 			}
 		}
-		else if (btn->GetCheck()) {
+		else if (GetCheck(IDC_ENABLE_ATTR_COLOR_REVERSE)) {
 			TmpColor = ts.VTColor[0];
 			ts.VTColor[0] = ts.VTReverseColor[0];
 			ts.VTReverseColor[0] = ts.VTColor[1];
@@ -1396,25 +1002,22 @@
 			ts.ColorFlag ^= CF_REVERSECOLOR;
 		}
 	}
-	else if (((ts.ColorFlag & CF_REVERSECOLOR) != 0) != btn->GetCheck()) {
+	else if (((ts.ColorFlag & CF_REVERSECOLOR) != 0) != GetCheck(IDC_ENABLE_ATTR_COLOR_REVERSE)) {
 		ts.ColorFlag ^= CF_REVERSECOLOR;
 	}
 
 	// (9) URL Color
-	btn = (CButton *)GetDlgItem(IDC_ENABLE_URL_COLOR);
-	if (((ts.ColorFlag & CF_URLCOLOR) != 0) != btn->GetCheck()) {
+	if (((ts.ColorFlag & CF_URLCOLOR) != 0) != GetCheck(IDC_ENABLE_URL_COLOR)) {
 		ts.ColorFlag ^= CF_URLCOLOR;
 	}
 
 	// (10) Color
-	btn = (CButton *)GetDlgItem(IDC_ENABLE_ANSI_COLOR);
-	if (((ts.ColorFlag & CF_ANSICOLOR) != 0) != btn->GetCheck()) {
+	if (((ts.ColorFlag & CF_ANSICOLOR) != 0) != GetCheck(IDC_ENABLE_ANSI_COLOR)) {
 		ts.ColorFlag ^= CF_ANSICOLOR;
 	}
 
 	// (11) URL Underline
-	btn = (CButton *)GetDlgItem(IDC_URL_UNDERLINE);
-	if (((ts.FontFlag & FF_URLUNDERLINE) != 0) != btn->GetCheck()) {
+	if (((ts.FontFlag & FF_URLUNDERLINE) != 0) != GetCheck(IDC_URL_UNDERLINE)) {
 		ts.FontFlag ^= FF_URLUNDERLINE;
 	}
 
@@ -1428,32 +1031,29 @@
 
 // CLogPropPageDlg \x83_\x83C\x83A\x83\x8D\x83O
 
-IMPLEMENT_DYNAMIC(CLogPropPageDlg, CPropertyPage)
-
-CLogPropPageDlg::CLogPropPageDlg()
-	: CPropertyPage(CLogPropPageDlg::IDD)
+CLogPropPageDlg::CLogPropPageDlg(HINSTANCE inst, TTCPropertySheet *sheet)
+	: TTCPropertyPage(inst, CLogPropPageDlg::IDD, sheet)
 {
-
+	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;
 }
 
 CLogPropPageDlg::~CLogPropPageDlg()
 {
-	if (DlgLogFont != NULL) {
-		DeleteObject(DlgLogFont);
-	}
+	free((void *)m_psp.pszTitle);
 }
 
-BEGIN_MESSAGE_MAP(CLogPropPageDlg, CPropertyPage)
-END_MESSAGE_MAP()
-
 // CLogPropPageDlg \x83\x81\x83b\x83Z\x81[\x83W \x83n\x83\x93\x83h\x83\x89
 
 #define LOG_ROTATE_SIZETYPE_NUM 3
-static char *LogRotateSizeType[] = {
+static const char *LogRotateSizeType[] = {
 	"Byte", "KB", "MB"
 };
 
-static char *GetLogRotateSizeType(int val)
+static const char *GetLogRotateSizeType(int val)
 {
 	if (val >= LOG_ROTATE_SIZETYPE_NUM)
 		val = 0;
@@ -1461,175 +1061,101 @@
 	return LogRotateSizeType[val];
 }
 
-BOOL CLogPropPageDlg::OnInitDialog()
+void CLogPropPageDlg::OnInitDialog()
 {
-	char uimsg[MAX_UIMSG];
-	CButton *btn;
-	CComboBox *combo;
-	int i, TmpLogRotateSize;
+	TTCPropertyPage::OnInitDialog();
 
-	CPropertyPage::OnInitDialog();
-
-	font = (HFONT)SendMessage(WM_GETFONT, 0, 0);
-	GetObject(font, sizeof(LOGFONT), &logfont);
-	if (get_lang_font("DLG_TAHOMA_FONT", GetSafeHwnd(), &logfont, &DlgLogFont, ts.UILanguageFile)) {
-		SendDlgItemMessage(IDC_VIEWLOG_LABEL, WM_SETFONT, (WPARAM)DlgLogFont, MAKELPARAM(TRUE,0));
-		SendDlgItemMessage(IDC_VIEWLOG_EDITOR, WM_SETFONT, (WPARAM)DlgLogFont, MAKELPARAM(TRUE,0));
-		SendDlgItemMessage(IDC_VIEWLOG_PATH, WM_SETFONT, (WPARAM)DlgLogFont, MAKELPARAM(TRUE,0));
-		SendDlgItemMessage(IDC_DEFAULTNAME_LABEL, WM_SETFONT, (WPARAM)DlgLogFont, MAKELPARAM(TRUE,0));
-		SendDlgItemMessage(IDC_DEFAULTNAME_EDITOR, WM_SETFONT, (WPARAM)DlgLogFont, MAKELPARAM(TRUE,0));
-		SendDlgItemMessage(IDC_DEFAULTPATH_LABEL, WM_SETFONT, (WPARAM)DlgLogFont, MAKELPARAM(TRUE,0));
-		SendDlgItemMessage(IDC_DEFAULTPATH_EDITOR, WM_SETFONT, (WPARAM)DlgLogFont, MAKELPARAM(TRUE,0));
-		SendDlgItemMessage(IDC_DEFAULTPATH_PUSH, WM_SETFONT, (WPARAM)DlgLogFont, MAKELPARAM(TRUE,0));
-		SendDlgItemMessage(IDC_AUTOSTART, WM_SETFONT, (WPARAM)DlgLogFont, MAKELPARAM(TRUE,0));
-
+	static const DlgTextInfo TextInfos[] = {
+		{ IDC_VIEWLOG_LABEL, "DLG_TAB_LOG_EDITOR" },
+		{ IDC_DEFAULTNAME_LABEL, "DLG_TAB_LOG_FILENAME" },
+		{ IDC_DEFAULTPATH_LABEL, "DLG_TAB_LOG_FILEPATH" },
+		{ IDC_AUTOSTART, "DLG_TAB_LOG_AUTOSTART" },
 		// Log rotate
-		SendDlgItemMessage(IDC_LOG_ROTATE, WM_SETFONT, (WPARAM)DlgLogFont, MAKELPARAM(TRUE,0));
-		SendDlgItemMessage(IDC_ROTATE_SIZE_TEXT, WM_SETFONT, (WPARAM)DlgLogFont, MAKELPARAM(TRUE,0));
-		SendDlgItemMessage(IDC_ROTATE_SIZE, WM_SETFONT, (WPARAM)DlgLogFont, MAKELPARAM(TRUE,0));
-		SendDlgItemMessage(IDC_ROTATE_SIZE_TYPE, WM_SETFONT, (WPARAM)DlgLogFont, MAKELPARAM(TRUE,0));
-		SendDlgItemMessage(IDC_ROTATE_STEP_TEXT, WM_SETFONT, (WPARAM)DlgLogFont, MAKELPARAM(TRUE,0));
-		SendDlgItemMessage(IDC_ROTATE_STEP, WM_SETFONT, (WPARAM)DlgLogFont, MAKELPARAM(TRUE,0));
-
+		{ IDC_LOG_ROTATE, "DLG_TAB_LOG_ROTATE" },
+		{ IDC_ROTATE_SIZE_TEXT, "DLG_TAB_LOG_ROTATE_SIZE_TEXT" },
+		{ IDC_ROTATE_STEP_TEXT, "DLG_TAB_LOG_ROTATESTEP" },
 		// Log options
-		SendDlgItemMessage(IDC_LOG_OPTION_GROUP, WM_SETFONT, (WPARAM)DlgLogFont, MAKELPARAM(TRUE,0));
-		SendDlgItemMessage(IDC_OPT_BINARY, WM_SETFONT, (WPARAM)DlgLogFont, MAKELPARAM(TRUE,0));
-		SendDlgItemMessage(IDC_OPT_APPEND, WM_SETFONT, (WPARAM)DlgLogFont, MAKELPARAM(TRUE,0));
-		SendDlgItemMessage(IDC_OPT_PLAINTEXT, WM_SETFONT, (WPARAM)DlgLogFont, MAKELPARAM(TRUE,0));
-		SendDlgItemMessage(IDC_OPT_TIMESTAMP, WM_SETFONT, (WPARAM)DlgLogFont, MAKELPARAM(TRUE,0));
-		SendDlgItemMessage(IDC_OPT_HIDEDLG, WM_SETFONT, (WPARAM)DlgLogFont, MAKELPARAM(TRUE,0));
-		SendDlgItemMessage(IDC_OPT_INCBUF, WM_SETFONT, (WPARAM)DlgLogFont, MAKELPARAM(TRUE,0));
-	}
-	else {
-		DlgLogFont = NULL;
-	}
+		// FIXME: \x83\x81\x83b\x83Z\x81[\x83W\x83J\x83^\x83\x8D\x83O\x82͊\xF9\x91\xB6\x82̃\x8D\x83O\x83I\x83v\x83V\x83\x87\x83\x93\x82̂\xE0\x82̂𗬗p\x82\xB5\x82\xBD\x82\xAA\x81A\x83A\x83N\x83Z\x83\x89\x83\x8C\x81[\x83^\x83L\x81[\x82\xAA\x8Fd\x95\xA1\x82\xB7\x82邩\x82\xE0\x82\xB5\x82\xEA\x82Ȃ\xA2\x81B
+		{ IDC_LOG_OPTION_GROUP, "DLG_FOPT" },
+		{ IDC_OPT_BINARY, "DLG_FOPT_BINARY" },
+		{ IDC_OPT_APPEND, "DLG_FOPT_APPEND" },
+		{ IDC_OPT_PLAINTEXT, "DLG_FOPT_PLAIN" },
+		{ IDC_OPT_HIDEDLG, "DLG_FOPT_HIDEDIALOG" },
+		{ IDC_OPT_INCBUF, "DLG_FOPT_ALLBUFFINFIRST" },
+		{ IDC_OPT_TIMESTAMP, "DLG_FOPT_TIMESTAMP" },
+	};
+	SetDlgTexts(m_hWnd, TextInfos, _countof(TextInfos), ts.UILanguageFile);
 
-	GetDlgItemText(IDC_VIEWLOG_LABEL, uimsg, sizeof(uimsg));
-	get_lang_msg("DLG_TAB_LOG_EDITOR", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
-	SetDlgItemText(IDC_VIEWLOG_LABEL, ts.UIMsg);
-	GetDlgItemText(IDC_DEFAULTNAME_LABEL, uimsg, sizeof(uimsg));
-	get_lang_msg("DLG_TAB_LOG_FILENAME", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
-	SetDlgItemText(IDC_DEFAULTNAME_LABEL, ts.UIMsg);
-	GetDlgItemText(IDC_DEFAULTPATH_LABEL, uimsg, sizeof(uimsg));
-	get_lang_msg("DLG_TAB_LOG_FILEPATH", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
-	SetDlgItemText(IDC_DEFAULTPATH_LABEL, ts.UIMsg);
-	GetDlgItemText(IDC_AUTOSTART, uimsg, sizeof(uimsg));
-	get_lang_msg("DLG_TAB_LOG_AUTOSTART", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
-	SetDlgItemText(IDC_AUTOSTART, ts.UIMsg);
-	// Log rotate
-	GetDlgItemText(IDC_LOG_ROTATE, uimsg, sizeof(uimsg));
-	get_lang_msg("DLG_TAB_LOG_ROTATE", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
-	SetDlgItemText(IDC_LOG_ROTATE, ts.UIMsg);
-	GetDlgItemText(IDC_ROTATE_SIZE_TEXT, uimsg, sizeof(uimsg));
-	get_lang_msg("DLG_TAB_LOG_ROTATE_SIZE_TEXT", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
-	SetDlgItemText(IDC_ROTATE_SIZE_TEXT, ts.UIMsg);
-	GetDlgItemText(IDC_ROTATE_STEP_TEXT, uimsg, sizeof(uimsg));
-	get_lang_msg("DLG_TAB_LOG_ROTATESTEP", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
-	SetDlgItemText(IDC_ROTATE_STEP_TEXT, ts.UIMsg);
-	// Log options
-	// FIXME: \x83\x81\x83b\x83Z\x81[\x83W\x83J\x83^\x83\x8D\x83O\x82͊\xF9\x91\xB6\x82̃\x8D\x83O\x83I\x83v\x83V\x83\x87\x83\x93\x82̂\xE0\x82̂𗬗p\x82\xB5\x82\xBD\x82\xAA\x81A\x83A\x83N\x83Z\x83\x89\x83\x8C\x81[\x83^\x83L\x81[\x82\xAA\x8Fd\x95\xA1\x82\xB7\x82邩\x82\xE0\x82\xB5\x82\xEA\x82Ȃ\xA2\x81B
-	GetDlgItemText(IDC_LOG_OPTION_GROUP, uimsg, sizeof(uimsg));
-	get_lang_msg("DLG_FOPT", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
-	SetDlgItemText(IDC_LOG_OPTION_GROUP, ts.UIMsg);
-	GetDlgItemText(IDC_OPT_BINARY, uimsg, sizeof(uimsg));
-	get_lang_msg("DLG_FOPT_BINARY", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
-	SetDlgItemText(IDC_OPT_BINARY, ts.UIMsg);
-	GetDlgItemText(IDC_OPT_APPEND, uimsg, sizeof(uimsg));
-	get_lang_msg("DLG_FOPT_APPEND", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
-	SetDlgItemText(IDC_OPT_APPEND, ts.UIMsg);
-	GetDlgItemText(IDC_OPT_PLAINTEXT, uimsg, sizeof(uimsg));
-	get_lang_msg("DLG_FOPT_PLAIN", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
-	SetDlgItemText(IDC_OPT_PLAINTEXT, ts.UIMsg);
-	GetDlgItemText(IDC_OPT_HIDEDLG, uimsg, sizeof(uimsg));
-	get_lang_msg("DLG_FOPT_HIDEDIALOG", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
-	SetDlgItemText(IDC_OPT_HIDEDLG, ts.UIMsg);
-	GetDlgItemText(IDC_OPT_INCBUF, uimsg, sizeof(uimsg));
-	get_lang_msg("DLG_FOPT_ALLBUFFINFIRST", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
-	SetDlgItemText(IDC_OPT_INCBUF, ts.UIMsg);
-	GetDlgItemText(IDC_OPT_TIMESTAMP, uimsg, sizeof(uimsg));
-	get_lang_msg("DLG_FOPT_TIMESTAMP", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
-	SetDlgItemText(IDC_OPT_TIMESTAMP, ts.UIMsg);
+	TCHAR UIMsg[MAX_UIMSG];
+	get_lang_msgT("DLG_FOPT_TIMESTAMP_LOCAL", UIMsg, _countof(UIMsg), _T("Local Time"), ts.UILanguageFile);
+	SendDlgItemMessage(IDC_OPT_TIMESTAMP_TYPE, CB_ADDSTRING, 0, (LPARAM)UIMsg);
+	get_lang_msgT("DLG_FOPT_TIMESTAMP_UTC", UIMsg, _countof(UIMsg), _T("UTC"), ts.UILanguageFile);
+	SendDlgItemMessage(IDC_OPT_TIMESTAMP_TYPE, CB_ADDSTRING, 0, (LPARAM)UIMsg);
+	get_lang_msgT("DLG_FOPT_TIMESTAMP_ELAPSED_LOGGING", UIMsg, _countof(UIMsg), _T("Elapsed Time (Logging)"), ts.UILanguageFile);
+	SendDlgItemMessage(IDC_OPT_TIMESTAMP_TYPE, CB_ADDSTRING, 0, (LPARAM)UIMsg);
+	get_lang_msgT("DLG_FOPT_TIMESTAMP_ELAPSED_CONNECTION", UIMsg, _countof(UIMsg), _T("Elapsed Time (Connection)"), ts.UILanguageFile);
+	SendDlgItemMessage(IDC_OPT_TIMESTAMP_TYPE, CB_ADDSTRING, 0, (LPARAM)UIMsg);
 
-	get_lang_msg("DLG_FOPT_TIMESTAMP_LOCAL", ts.UIMsg, sizeof(ts.UIMsg), "Local Time", ts.UILanguageFile);
-	SendDlgItemMessage(IDC_OPT_TIMESTAMP_TYPE, CB_ADDSTRING, 0, (LPARAM)ts.UIMsg);
-	get_lang_msg("DLG_FOPT_TIMESTAMP_UTC", ts.UIMsg, sizeof(ts.UIMsg), "UTC", ts.UILanguageFile);
-	SendDlgItemMessage(IDC_OPT_TIMESTAMP_TYPE, CB_ADDSTRING, 0, (LPARAM)ts.UIMsg);
-	get_lang_msg("DLG_FOPT_TIMESTAMP_ELAPSED_LOGGING", ts.UIMsg, sizeof(ts.UIMsg), "Elapsed Time (Logging)", ts.UILanguageFile);
-	SendDlgItemMessage(IDC_OPT_TIMESTAMP_TYPE, CB_ADDSTRING, 0, (LPARAM)ts.UIMsg);
-	get_lang_msg("DLG_FOPT_TIMESTAMP_ELAPSED_CONNECTION", ts.UIMsg, sizeof(ts.UIMsg), "Elapsed Time (Connection)", ts.UILanguageFile);
-	SendDlgItemMessage(IDC_OPT_TIMESTAMP_TYPE, CB_ADDSTRING, 0, (LPARAM)ts.UIMsg);
 
-
 	// 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) */
-	btn = (CButton *)GetDlgItem(IDC_AUTOSTART);
-	btn->SetCheck(ts.LogAutoStart);
+	SetCheck(IDC_AUTOSTART, ts.LogAutoStart);
 
 	// Log rotate
-	btn = (CButton *)GetDlgItem(IDC_LOG_ROTATE);
-	btn->SetCheck(ts.LogRotate != ROTATE_NONE);
+	SetCheck(IDC_LOG_ROTATE, ts.LogRotate != ROTATE_NONE);
 
-	combo = (CComboBox *)GetDlgItem(IDC_ROTATE_SIZE_TYPE);
-	for (i = 0 ; i < LOG_ROTATE_SIZETYPE_NUM ; i++) {
-		combo->AddString(LogRotateSizeType[i]);
+	for (int i = 0 ; i < LOG_ROTATE_SIZETYPE_NUM ; i++) {
+		SendDlgItemMessageA(IDC_ROTATE_SIZE_TYPE, CB_ADDSTRING, 0, (LPARAM)LogRotateSizeType[i]);
 	}
-
-	TmpLogRotateSize = ts.LogRotateSize;
-	for (i = 0 ; i < ts.LogRotateSizeType ; i++)
+	int TmpLogRotateSize = ts.LogRotateSize;
+	for (int i = 0 ; i < ts.LogRotateSizeType ; i++)
 		TmpLogRotateSize /= 1024;
 	SetDlgItemInt(IDC_ROTATE_SIZE, TmpLogRotateSize, FALSE);
-	combo->SelectString(-1, GetLogRotateSizeType(ts.LogRotateSizeType));
+	SendDlgItemMessageA(IDC_ROTATE_SIZE_TYPE, CB_SELECTSTRING, -1, (LPARAM)GetLogRotateSizeType(ts.LogRotateSizeType));
 	SetDlgItemInt(IDC_ROTATE_STEP, ts.LogRotateStep, FALSE);
 	if (ts.LogRotate == ROTATE_NONE) {
-		GetDlgItem(IDC_ROTATE_SIZE_TEXT)->EnableWindow(FALSE);
-		GetDlgItem(IDC_ROTATE_SIZE)->EnableWindow(FALSE);
-		GetDlgItem(IDC_ROTATE_SIZE_TYPE)->EnableWindow(FALSE);
-		GetDlgItem(IDC_ROTATE_STEP_TEXT)->EnableWindow(FALSE);
-		GetDlgItem(IDC_ROTATE_STEP)->EnableWindow(FALSE);
+		EnableDlgItem(IDC_ROTATE_SIZE_TEXT, FALSE);
+		EnableDlgItem(IDC_ROTATE_SIZE, FALSE);
+		EnableDlgItem(IDC_ROTATE_SIZE_TYPE, FALSE);
+		EnableDlgItem(IDC_ROTATE_STEP_TEXT, FALSE);
+		EnableDlgItem(IDC_ROTATE_STEP, FALSE);
 	} else {
-		GetDlgItem(IDC_ROTATE_SIZE_TEXT)->EnableWindow(TRUE);
-		GetDlgItem(IDC_ROTATE_SIZE)->EnableWindow(TRUE);
-		GetDlgItem(IDC_ROTATE_SIZE_TYPE)->EnableWindow(TRUE);
-		GetDlgItem(IDC_ROTATE_STEP_TEXT)->EnableWindow(TRUE);
-		GetDlgItem(IDC_ROTATE_STEP)->EnableWindow(TRUE);
+		EnableDlgItem(IDC_ROTATE_SIZE_TEXT, TRUE);
+		EnableDlgItem(IDC_ROTATE_SIZE, TRUE);
+		EnableDlgItem(IDC_ROTATE_SIZE_TYPE, TRUE);
+		EnableDlgItem(IDC_ROTATE_STEP_TEXT, TRUE);
+		EnableDlgItem(IDC_ROTATE_STEP, TRUE);
 	}
 
 	// Log options
-	btn = (CButton *)GetDlgItem(IDC_OPT_BINARY);
-	btn->SetCheck(ts.LogBinary != 0);
+	SetCheck(IDC_OPT_BINARY, ts.LogBinary != 0);
 	if (ts.LogBinary) {
-		GetDlgItem(IDC_OPT_PLAINTEXT)->EnableWindow(FALSE);
-		GetDlgItem(IDC_OPT_TIMESTAMP)->EnableWindow(FALSE);
+		EnableDlgItem(IDC_OPT_PLAINTEXT, FALSE);
+		EnableDlgItem(IDC_OPT_TIMESTAMP, FALSE);
 	} else {
-		GetDlgItem(IDC_OPT_PLAINTEXT)->EnableWindow(TRUE);
-		GetDlgItem(IDC_OPT_TIMESTAMP)->EnableWindow(TRUE);
+		EnableDlgItem(IDC_OPT_PLAINTEXT, TRUE);
+		EnableDlgItem(IDC_OPT_TIMESTAMP, TRUE);
 	}
-	btn = (CButton *)GetDlgItem(IDC_OPT_APPEND);
-	btn->SetCheck(ts.Append != 0);
-	btn = (CButton *)GetDlgItem(IDC_OPT_PLAINTEXT);
-	btn->SetCheck(ts.LogTypePlainText != 0);
-	btn = (CButton *)GetDlgItem(IDC_OPT_HIDEDLG);
-	btn->SetCheck(ts.LogHideDialog != 0);
-	btn = (CButton *)GetDlgItem(IDC_OPT_INCBUF);
-	btn->SetCheck(ts.LogAllBuffIncludedInFirst != 0);
-	btn = (CButton *)GetDlgItem(IDC_OPT_TIMESTAMP);
-	btn->SetCheck(ts.LogTimestamp != 0);
+	SetCheck(IDC_OPT_APPEND, ts.Append != 0);
+	SetCheck(IDC_OPT_PLAINTEXT, ts.LogTypePlainText != 0);
+	SetCheck(IDC_OPT_HIDEDLG, ts.LogHideDialog != 0);
+	SetCheck(IDC_OPT_INCBUF, ts.LogAllBuffIncludedInFirst != 0);
+	SetCheck(IDC_OPT_TIMESTAMP, ts.LogTimestamp != 0);
 
-	combo = (CComboBox *)GetDlgItem(IDC_OPT_TIMESTAMP_TYPE);
-	combo->SetCurSel(ts.LogTimestampType);
+	SetCurSel(IDC_OPT_TIMESTAMP_TYPE, ts.LogTimestampType);
 	if (ts.LogBinary || !ts.LogTimestamp) {
-		GetDlgItem(IDC_OPT_TIMESTAMP_TYPE)->EnableWindow(FALSE);
+		EnableDlgItem(IDC_OPT_TIMESTAMP_TYPE, FALSE);
 	}
 	else {
-		GetDlgItem(IDC_OPT_TIMESTAMP_TYPE)->EnableWindow(TRUE);
+		EnableDlgItem(IDC_OPT_TIMESTAMP_TYPE, TRUE);
 	}
 /*
 	switch (ts.LogTimestampType) {
@@ -1650,22 +1176,21 @@
 
 	// \x83_\x83C\x83A\x83\x8D\x83O\x82Ƀt\x83H\x81[\x83J\x83X\x82𓖂Ă\xE9
 	::SetFocus(::GetDlgItem(GetSafeHwnd(), IDC_VIEWLOG_EDITOR));
-
-	return FALSE;
 }
 
 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();
+				ofn.lStructSize = get_OPENFILENAME_SIZEA();
 				ofn.hwndOwner = GetSafeHwnd();
 				get_lang_msg("FILEDLG_SELECT_LOGVIEW_APP_FILTER", ts.UIMsg, sizeof(ts.UIMsg),
 				             "exe(*.exe)\\0*.exe\\0all(*.*)\\0*.*\\0\\0", ts.UILanguageFile);
@@ -1676,8 +1201,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;
@@ -1695,20 +1220,18 @@
 
 		case IDC_LOG_ROTATE | (BN_CLICKED << 16):
 			{
-				CButton *btn;
-				btn = (CButton *)GetDlgItem(IDC_LOG_ROTATE);
-				if (btn->GetCheck()) {
-					GetDlgItem(IDC_ROTATE_SIZE_TEXT)->EnableWindow(TRUE);
-					GetDlgItem(IDC_ROTATE_SIZE)->EnableWindow(TRUE);
-					GetDlgItem(IDC_ROTATE_SIZE_TYPE)->EnableWindow(TRUE);
-					GetDlgItem(IDC_ROTATE_STEP_TEXT)->EnableWindow(TRUE);
-					GetDlgItem(IDC_ROTATE_STEP)->EnableWindow(TRUE);
+				if (GetCheck(IDC_LOG_ROTATE)) {
+					EnableDlgItem(IDC_ROTATE_SIZE_TEXT, TRUE);
+					EnableDlgItem(IDC_ROTATE_SIZE, TRUE);
+					EnableDlgItem(IDC_ROTATE_SIZE_TYPE, TRUE);
+					EnableDlgItem(IDC_ROTATE_STEP_TEXT, TRUE);
+					EnableDlgItem(IDC_ROTATE_STEP, TRUE);
 				} else {
-					GetDlgItem(IDC_ROTATE_SIZE_TEXT)->EnableWindow(FALSE);
-					GetDlgItem(IDC_ROTATE_SIZE)->EnableWindow(FALSE);
-					GetDlgItem(IDC_ROTATE_SIZE_TYPE)->EnableWindow(FALSE);
-					GetDlgItem(IDC_ROTATE_STEP_TEXT)->EnableWindow(FALSE);
-					GetDlgItem(IDC_ROTATE_STEP)->EnableWindow(FALSE);
+					EnableDlgItem(IDC_ROTATE_SIZE_TEXT, FALSE);
+					EnableDlgItem(IDC_ROTATE_SIZE, FALSE);
+					EnableDlgItem(IDC_ROTATE_SIZE_TYPE, FALSE);
+					EnableDlgItem(IDC_ROTATE_STEP_TEXT, FALSE);
+					EnableDlgItem(IDC_ROTATE_STEP, FALSE);
 				}
 
 			}
@@ -1716,19 +1239,16 @@
 
 		case IDC_OPT_BINARY | (BN_CLICKED << 16):
 			{
-				CButton *btn;
-				btn = (CButton *)GetDlgItem(IDC_OPT_BINARY);
-				if (btn->GetCheck()) {
-					GetDlgItem(IDC_OPT_PLAINTEXT)->EnableWindow(FALSE);
-					GetDlgItem(IDC_OPT_TIMESTAMP)->EnableWindow(FALSE);
-					GetDlgItem(IDC_OPT_TIMESTAMP_TYPE)->EnableWindow(FALSE);
+				if (GetCheck(IDC_OPT_BINARY)) {
+					EnableDlgItem(IDC_OPT_PLAINTEXT, FALSE);
+					EnableDlgItem(IDC_OPT_TIMESTAMP, FALSE);
+					EnableDlgItem(IDC_OPT_TIMESTAMP_TYPE, FALSE);
 				} else {
-					GetDlgItem(IDC_OPT_PLAINTEXT)->EnableWindow(TRUE);
-					GetDlgItem(IDC_OPT_TIMESTAMP)->EnableWindow(TRUE);
+					EnableDlgItem(IDC_OPT_PLAINTEXT, TRUE);
+					EnableDlgItem(IDC_OPT_TIMESTAMP, TRUE);
 
-					btn = (CButton *)GetDlgItem(IDC_OPT_TIMESTAMP);
-					if (btn->GetCheck()) {
-						GetDlgItem(IDC_OPT_TIMESTAMP_TYPE)->EnableWindow(TRUE);
+					if (GetCheck(IDC_OPT_TIMESTAMP)) {
+						EnableDlgItem(IDC_OPT_TIMESTAMP_TYPE, TRUE);
 					}
 				}
 			}
@@ -1736,18 +1256,16 @@
 
 		case IDC_OPT_TIMESTAMP | (BN_CLICKED << 16):
 			{
-				CButton *btn;
-				btn = (CButton *)GetDlgItem(IDC_OPT_TIMESTAMP);
-				if (btn->GetCheck()) {
-					GetDlgItem(IDC_OPT_TIMESTAMP_TYPE)->EnableWindow(TRUE);
+				if (GetCheck(IDC_OPT_TIMESTAMP)) {
+					EnableDlgItem(IDC_OPT_TIMESTAMP_TYPE, TRUE);
 				} else {
-					GetDlgItem(IDC_OPT_TIMESTAMP_TYPE)->EnableWindow(FALSE);
+					EnableDlgItem(IDC_OPT_TIMESTAMP_TYPE, FALSE);
 				}
 			}
 			return TRUE;
 	}
 
-	return CPropertyPage::OnCommand(wParam, lParam);
+	return TTCPropertyPage::OnCommand(wParam, lParam);
 }
 
 void CLogPropPageDlg::OnOK()
@@ -1755,67 +1273,61 @@
 	char buf[80], buf2[80];
 	time_t time_local;
 	struct tm *tm_local;
-	char uimsg[MAX_UIMSG];
-	CButton *btn;
-	CString str;
-	CComboBox *cmb;
-	int i;
+	TCHAR uimsg[MAX_UIMSG];
+	TCHAR uimsg2[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);
+		get_lang_msgT("MSG_ERROR", uimsg, _countof(uimsg), _T("ERROR"), ts.UILanguageFile);
+		get_lang_msgT("MSG_LOGFILE_INVALID_CHAR_ERROR", uimsg2, _countof(uimsg2),
+		              _T("Invalid character is included in log file name."), ts.UILanguageFile);
+		MessageBox(uimsg2, uimsg, MB_ICONEXCLAMATION);
 		return;
 	}
+
 	// \x8C\xBB\x8Dݎ\x9E\x8D\x8F\x82\xF0\x8E擾
 	time(&time_local);
 	tm_local = localtime(&time_local);
 	// \x8E\x9E\x8D\x8F\x95\xB6\x8E\x9A\x97\xF1\x82ɕϊ\xB7
 	if (strlen(buf) != 0 && strftime(buf2, sizeof(buf2), buf, tm_local) == 0) {
-		get_lang_msg("MSG_ERROR", uimsg, sizeof(uimsg), "ERROR", ts.UILanguageFile);
-		get_lang_msg("MSG_LOGFILE_TOOLONG_ERROR", ts.UIMsg, sizeof(ts.UIMsg),
-		             "The log file name is too long.", ts.UILanguageFile);
-		MessageBox(ts.UIMsg, uimsg, MB_ICONEXCLAMATION);
+		get_lang_msgT("MSG_ERROR", uimsg, _countof(uimsg), _T("ERROR"), ts.UILanguageFile);
+		get_lang_msgT("MSG_LOGFILE_TOOLONG_ERROR", uimsg2, _countof(uimsg2),
+					  _T("The log file name is too long."), ts.UILanguageFile);
+		MessageBox(uimsg2, uimsg, MB_ICONEXCLAMATION);
 		return;
 	}
 	if (isInvalidFileNameChar(buf2)) {
-		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);
+		get_lang_msgT("MSG_ERROR", uimsg, _countof(uimsg), _T("ERROR"), ts.UILanguageFile);
+		get_lang_msgT("MSG_LOGFILE_INVALID_CHAR_ERROR", uimsg2, _countof(uimsg2),
+					  _T("Invalid character is included in log file name."), ts.UILanguageFile);
+		MessageBox(uimsg2, uimsg, MB_ICONEXCLAMATION);
 		return;
 	}
 	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) */
-	btn = (CButton *)GetDlgItem(IDC_AUTOSTART);
-	ts.LogAutoStart = btn->GetCheck();
+	ts.LogAutoStart = GetCheck(IDC_AUTOSTART);
 
 	/* Log Rotate */
-	btn = (CButton *)GetDlgItem(IDC_LOG_ROTATE);
-	if (btn->GetCheck()) {  /* on */
+	if (GetCheck(IDC_LOG_ROTATE)) {  /* on */
 		ts.LogRotate = ROTATE_SIZE;
-
-		((CComboBox*)GetDlgItem(IDC_ROTATE_SIZE_TYPE))->GetWindowText(str);
-		for (i = 0 ; i < LOG_ROTATE_SIZETYPE_NUM ; i++) {
-			if (strcmp(str, LogRotateSizeType[i]) == 0)
+		GetDlgItemText(IDC_ROTATE_SIZE_TYPE, buf, _countof(buf));
+		ts.LogRotateSizeType = 0;
+		for (int i = 0 ; i < LOG_ROTATE_SIZETYPE_NUM ; i++) {
+			if (strcmp(buf, LogRotateSizeType[i]) == 0) {
+				ts.LogRotateSizeType = i;
 				break;
+			}
 		}
-		if (i >= LOG_ROTATE_SIZETYPE_NUM)
-			i = 0;
-		ts.LogRotateSizeType = i;
-
 		ts.LogRotateSize = GetDlgItemInt(IDC_ROTATE_SIZE);
-		for (i = 0 ; i < ts.LogRotateSizeType ; i++)
+		for (int i = 0 ; i < ts.LogRotateSizeType ; i++)
 			ts.LogRotateSize *= 1024;
 
 		ts.LogRotateStep = GetDlgItemInt(IDC_ROTATE_STEP);
@@ -1826,8 +1338,7 @@
 	}
 
 	// Log Options
-	btn = (CButton *)GetDlgItem(IDC_OPT_BINARY);
-	if (btn->GetCheck()) {
+	if (GetCheck(IDC_OPT_BINARY)) {
 		ts.LogBinary = 1;
 	}
 	else {
@@ -1834,8 +1345,7 @@
 		ts.LogBinary = 0;
 	}
 
-	btn = (CButton *)GetDlgItem(IDC_OPT_APPEND);
-	if (btn->GetCheck()) {
+	if (GetCheck(IDC_OPT_APPEND)) {
 		ts.Append = 1;
 	}
 	else {
@@ -1842,8 +1352,7 @@
 		ts.Append = 0;
 	}
 
-	btn = (CButton *)GetDlgItem(IDC_OPT_PLAINTEXT);
-	if (btn->GetCheck()) {
+	if (GetCheck(IDC_OPT_PLAINTEXT)) {
 		ts.LogTypePlainText = 1;
 	}
 	else {
@@ -1850,8 +1359,7 @@
 		ts.LogTypePlainText = 0;
 	}
 
-	btn = (CButton *)GetDlgItem(IDC_OPT_HIDEDLG);
-	if (btn->GetCheck()) {
+	if (GetCheck(IDC_OPT_HIDEDLG)) {
 		ts.LogHideDialog = 1;
 	}
 	else {
@@ -1858,8 +1366,7 @@
 		ts.LogHideDialog = 0;
 	}
 
-	btn = (CButton *)GetDlgItem(IDC_OPT_INCBUF);
-	if (btn->GetCheck()) {
+	if (GetCheck(IDC_OPT_INCBUF)) {
 		ts.LogAllBuffIncludedInFirst = 1;
 	}
 	else {
@@ -1866,8 +1373,7 @@
 		ts.LogAllBuffIncludedInFirst = 0;
 	}
 
-	btn = (CButton *)GetDlgItem(IDC_OPT_TIMESTAMP);
-	if (btn->GetCheck()) {
+	if (GetCheck(IDC_OPT_TIMESTAMP)) {
 		ts.LogTimestamp = 1;
 	}
 	else {
@@ -1874,95 +1380,58 @@
 		ts.LogTimestamp = 0;
 	}
 
-	cmb = (CComboBox *)GetDlgItem(IDC_OPT_TIMESTAMP_TYPE);
-	ts.LogTimestampType = cmb->GetCurSel();
+	ts.LogTimestampType = GetCurSel(IDC_OPT_TIMESTAMP_TYPE);
 }
 
+/////////////////////////////
 
 // CCygwinPropPageDlg \x83_\x83C\x83A\x83\x8D\x83O
 
-IMPLEMENT_DYNAMIC(CCygwinPropPageDlg, CPropertyPage)
-
-CCygwinPropPageDlg::CCygwinPropPageDlg()
-	: CPropertyPage(CCygwinPropPageDlg::IDD)
+CCygwinPropPageDlg::CCygwinPropPageDlg(HINSTANCE inst, TTCPropertySheet *sheet)
+	: TTCPropertyPage(inst, CCygwinPropPageDlg::IDD, sheet)
 {
+	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;
 }
 
 CCygwinPropPageDlg::~CCygwinPropPageDlg()
 {
-	if (DlgCygwinFont != NULL) {
-		DeleteObject(DlgCygwinFont);
-	}
+	free((void *)m_psp.pszTitle);
 }
 
-BEGIN_MESSAGE_MAP(CCygwinPropPageDlg, CPropertyPage)
-END_MESSAGE_MAP()
-
 // CCygwinPropPageDlg \x83\x81\x83b\x83Z\x81[\x83W \x83n\x83\x93\x83h\x83\x89
 
-BOOL CCygwinPropPageDlg::OnInitDialog()
+void CCygwinPropPageDlg::OnInitDialog()
 {
-	char uimsg[MAX_UIMSG];
-	CButton *btn;
+	TTCPropertyPage::OnInitDialog();
 
-	CPropertyPage::OnInitDialog();
+	static const DlgTextInfo TextInfos[] = {
+		{ IDC_CYGWIN_PATH_LABEL, "DLG_TAB_CYGWIN_PATH" }
+	};
+	SetDlgTexts(m_hWnd, TextInfos, _countof(TextInfos), ts.UILanguageFile);
 
-	font = (HFONT)SendMessage(WM_GETFONT, 0, 0);
-	GetObject(font, sizeof(LOGFONT), &logfont);
-	if (get_lang_font("DLG_TAHOMA_FONT", GetSafeHwnd(), &logfont, &DlgCygwinFont, ts.UILanguageFile)) {
-		SendDlgItemMessage(IDC_CYGWIN_PATH_LABEL, WM_SETFONT, (WPARAM)DlgCygwinFont, MAKELPARAM(TRUE,0));
-		SendDlgItemMessage(IDC_CYGWIN_PATH, WM_SETFONT, (WPARAM)DlgCygwinFont, MAKELPARAM(TRUE,0));
-		SendDlgItemMessage(IDC_SELECT_FILE, WM_SETFONT, (WPARAM)DlgCygwinFont, MAKELPARAM(TRUE,0));
-		SendDlgItemMessage(IDC_CYGWIN, WM_SETFONT, (WPARAM)DlgCygwinFont, MAKELPARAM(TRUE,0));
-		SendDlgItemMessage(IDC_TERM_LABEL, WM_SETFONT, (WPARAM)DlgCygwinFont, MAKELPARAM(TRUE,0));
-		SendDlgItemMessage(IDC_TERM_EDIT, WM_SETFONT, (WPARAM)DlgCygwinFont, MAKELPARAM(TRUE,0));
-		SendDlgItemMessage(IDC_TERMTYPE_LABEL, WM_SETFONT, (WPARAM)DlgCygwinFont, MAKELPARAM(TRUE,0));
-		SendDlgItemMessage(IDC_TERM_TYPE, WM_SETFONT, (WPARAM)DlgCygwinFont, MAKELPARAM(TRUE,0));
-		SendDlgItemMessage(IDC_PORTSTART_LABEL, WM_SETFONT, (WPARAM)DlgCygwinFont, MAKELPARAM(TRUE,0));
-		SendDlgItemMessage(IDC_PORT_START, WM_SETFONT, (WPARAM)DlgCygwinFont, MAKELPARAM(TRUE,0));
-		SendDlgItemMessage(IDC_PORTRANGE_LABEL, WM_SETFONT, (WPARAM)DlgCygwinFont, MAKELPARAM(TRUE,0));
-		SendDlgItemMessage(IDC_PORT_RANGE, WM_SETFONT, (WPARAM)DlgCygwinFont, MAKELPARAM(TRUE,0));
-		SendDlgItemMessage(IDC_SHELL_LABEL, WM_SETFONT, (WPARAM)DlgCygwinFont, MAKELPARAM(TRUE,0));
-		SendDlgItemMessage(IDC_SHELL, WM_SETFONT, (WPARAM)DlgCygwinFont, MAKELPARAM(TRUE,0));
-		SendDlgItemMessage(IDC_ENV1_LABEL, WM_SETFONT, (WPARAM)DlgCygwinFont, MAKELPARAM(TRUE,0));
-		SendDlgItemMessage(IDC_ENV1, WM_SETFONT, (WPARAM)DlgCygwinFont, MAKELPARAM(TRUE,0));
-		SendDlgItemMessage(IDC_ENV2_LABEL, WM_SETFONT, (WPARAM)DlgCygwinFont, MAKELPARAM(TRUE,0));
-		SendDlgItemMessage(IDC_ENV2, WM_SETFONT, (WPARAM)DlgCygwinFont, MAKELPARAM(TRUE,0));
-		SendDlgItemMessage(IDC_LOGIN_SHELL, WM_SETFONT, (WPARAM)DlgCygwinFont, MAKELPARAM(TRUE,0));
-		SendDlgItemMessage(IDC_HOME_CHDIR, WM_SETFONT, (WPARAM)DlgCygwinFont, MAKELPARAM(TRUE,0));
-		SendDlgItemMessage(IDC_AGENT_PROXY, WM_SETFONT, (WPARAM)DlgCygwinFont, MAKELPARAM(TRUE,0));
-	}
-	else {
-		DlgCygwinFont = NULL;
-	}
+	memcpy(&settings, &ts.CygtermSettings, sizeof(cygterm_t));
 
-	GetDlgItemText(IDC_CYGWIN_PATH_LABEL, uimsg, sizeof(uimsg));
-	get_lang_msg("DLG_TAB_CYGWIN_PATH", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
-	SetDlgItemText(IDC_CYGWIN_PATH_LABEL, ts.UIMsg);
+	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);
 
-	memcpy(&settings, &ts.CygtermSettings, sizeof(cygterm_t));
+	SetCheck(IDC_LOGIN_SHELL, settings.login_shell);
+	SetCheck(IDC_HOME_CHDIR, settings.home_chdir);
+	SetCheck(IDC_AGENT_PROXY, settings.agent_proxy);
 
-	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);
-	btn = (CButton *)GetDlgItem(IDC_LOGIN_SHELL);
-	btn->SetCheck(settings.login_shell);
-	btn = (CButton *)GetDlgItem(IDC_HOME_CHDIR);
-	btn->SetCheck(settings.home_chdir);
-	btn = (CButton *)GetDlgItem(IDC_AGENT_PROXY);
-	btn->SetCheck(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));
-
-	return FALSE;
 }
 
 BOOL CCygwinPropPageDlg::OnCommand(WPARAM wParam, LPARAM lParam)
@@ -1974,35 +1443,31 @@
 			// 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;
 	}
 
-	return CPropertyPage::OnCommand(wParam, lParam);
+	return TTCPropertyPage::OnCommand(wParam, lParam);
 }
 
 void CCygwinPropPageDlg::OnOK()
 {
-	CButton *btn;
-
 	// 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));
-	btn = (CButton *)GetDlgItem(IDC_LOGIN_SHELL);
-	settings.login_shell = btn->GetCheck();
-	btn = (CButton *)GetDlgItem(IDC_HOME_CHDIR);
-	settings.home_chdir = btn->GetCheck();
-	btn = (CButton *)GetDlgItem(IDC_AGENT_PROXY);
-	settings.agent_proxy = btn->GetCheck();
+	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);
+	settings.agent_proxy = GetCheck(IDC_AGENT_PROXY);
+
 	memcpy(&ts.CygtermSettings, &settings, sizeof(cygterm_t));
 
 	// \x90ݒ\xE8\x82\xF0\x8F\x91\x82\xAB\x8D\x9E\x82ނ\xBD\x82߃t\x83\x89\x83O\x82𗧂ĂĂ\xA8\x82\xAD\x81B
@@ -2009,93 +1474,44 @@
 	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
-
-IMPLEMENT_DYNAMIC(CAddSettingPropSheetDlg, CPropertySheet)
-
-CAddSettingPropSheetDlg::CAddSettingPropSheetDlg(UINT nIDCaption, CWnd* pParentWnd, UINT iSelectPage)
-	:CPropertySheet(nIDCaption, pParentWnd, iSelectPage)
+CAddSettingPropSheetDlg::CAddSettingPropSheetDlg(
+	HINSTANCE hInstance, LPCTSTR pszCaption, HWND hParentWnd) :
+	TTCPropertySheet(hInstance, pszCaption, hParentWnd)
 {
-	AddPage(&m_GeneralPage);
-	AddPage(&m_SequencePage);
-	AddPage(&m_CopypastePage);
-	AddPage(&m_VisualPage);
-	AddPage(&m_LogPage);
-	AddPage(&m_CygwinPage);
+	m_GeneralPage = new CGeneralPropPageDlg(hInstance, this);
+	m_SequencePage = new CSequencePropPageDlg(hInstance, this);
+	m_CopypastePage = new CCopypastePropPageDlg(hInstance, this);
+	m_VisualPage = new CVisualPropPageDlg(hInstance, this);
+	m_LogPage = new CLogPropPageDlg(hInstance, this);
+	m_CygwinPage = new CCygwinPropPageDlg(hInstance, this);
+		
+	hPsp[0] = CreatePropertySheetPage(&m_GeneralPage->m_psp);
+	hPsp[1] = CreatePropertySheetPage(&m_SequencePage->m_psp);
+	hPsp[2] = CreatePropertySheetPage(&m_CopypastePage->m_psp);
+	hPsp[3] = CreatePropertySheetPage(&m_VisualPage->m_psp);
+	hPsp[4] = CreatePropertySheetPage(&m_LogPage->m_psp);
+	hPsp[5] = CreatePropertySheetPage(&m_CygwinPage->m_psp);
+	m_psh.nPages = 6;
+	m_psh.phpage = hPsp;
 
-	m_psh.dwFlags |= PSH_NOAPPLYNOW;
+	TCHAR UIMsg[MAX_UIMSG];
+	get_lang_msgT("DLG_TABSHEET_TITLE", UIMsg, _countof(UIMsg),
+				 pszCaption, ts.UILanguageFile);
+	m_psh.pszCaption = _tcsdup(UIMsg);
 }
 
-CAddSettingPropSheetDlg::CAddSettingPropSheetDlg(LPCTSTR pszCaption, CWnd* pParentWnd, UINT iSelectPage)
-	:CPropertySheet(pszCaption, pParentWnd, iSelectPage)
-{
-	AddPage(&m_GeneralPage);
-	AddPage(&m_SequencePage);
-	AddPage(&m_CopypastePage);
-	AddPage(&m_VisualPage);
-	AddPage(&m_LogPage);
-	AddPage(&m_CygwinPage);
-
-	m_psh.dwFlags |= PSH_NOAPPLYNOW;
-}
-
 CAddSettingPropSheetDlg::~CAddSettingPropSheetDlg()
 {
+	free((void*)m_psh.pszCaption);
+	delete m_GeneralPage;
+	delete m_SequencePage;
+	delete m_CopypastePage;
+	delete m_VisualPage;
+	delete m_LogPage;
+	delete m_CygwinPage;
 }
 
-
-BEGIN_MESSAGE_MAP(CAddSettingPropSheetDlg, CPropertySheet)
-END_MESSAGE_MAP()
-
-
-// CAddSettingPropSheetDlg \x83\x81\x83b\x83Z\x81[\x83W \x83n\x83\x93\x83h\x83\x89
-
-BOOL CAddSettingPropSheetDlg::OnInitDialog()
-{
-	CPropertySheet::OnInitDialog();
-
-	get_lang_msg("DLG_TABSHEET_TITLE", ts.UIMsg, sizeof(ts.UIMsg),
-	             "Tera Term: Additional settings", ts.UILanguageFile);
-	SetWindowText(ts.UIMsg);
-
-	CTabCtrl *tab = GetTabControl();
-	TCITEM tc;
-	tc.mask = TCIF_TEXT;
-
-	get_lang_msg("DLG_TABSHEET_TITLE_GENERAL", ts.UIMsg, sizeof(ts.UIMsg),
-	             "General", ts.UILanguageFile);
-	tc.pszText = ts.UIMsg;
-	tab->SetItem(0, &tc);
-
-	get_lang_msg("DLG_TABSHEET_TITLE_SEQUENCE", ts.UIMsg, sizeof(ts.UIMsg),
-	             "Control Sequence", ts.UILanguageFile);
-	tc.pszText = ts.UIMsg;
-	tab->SetItem(1, &tc);
-
-	get_lang_msg("DLG_TABSHEET_TITLE_COPYPASTE", ts.UIMsg, sizeof(ts.UIMsg),
-	             "Copy and Paste", ts.UILanguageFile);
-	tc.pszText = ts.UIMsg;
-	tab->SetItem(2, &tc);
-
-	get_lang_msg("DLG_TABSHEET_TITLE_VISUAL", ts.UIMsg, sizeof(ts.UIMsg),
-	             "Visual", ts.UILanguageFile);
-	tc.pszText = ts.UIMsg;
-	tab->SetItem(3, &tc);
-
-	get_lang_msg("DLG_TABSHEET_TITLE_Log", ts.UIMsg, sizeof(ts.UIMsg),
-	             "Log", ts.UILanguageFile);
-	tc.pszText = ts.UIMsg;
-	tab->SetItem(4, &tc);
-
-	get_lang_msg("DLG_TABSHEET_TITLE_CYGWIN", ts.UIMsg, sizeof(ts.UIMsg),
-	             "Cygwin", ts.UILanguageFile);
-	tc.pszText = ts.UIMsg;
-	tab->SetItem(5, &tc);
-
-	return FALSE;
-}

Modified: trunk/teraterm/teraterm/addsetting.h
===================================================================
--- trunk/teraterm/teraterm/addsetting.h	2019-03-28 16:09:45 UTC (rev 7524)
+++ trunk/teraterm/teraterm/addsetting.h	2019-03-28 16:38:16 UTC (rev 7525)
@@ -1,5 +1,5 @@
 /*
- * (C) 2008-2017 TeraTerm Project
+ * (C) 2008-2019 TeraTerm Project
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -28,191 +28,110 @@
 
 #pragma once
 
+#include "tmfc.h"
 #include "tt_res.h"
 #include "teraterm.h"
 
-
 typedef struct {
-	char *name;
+	const char *name;
 	LPCTSTR id;
 } mouse_cursor_t;
 
+extern const mouse_cursor_t MouseCursor[];
 
-
 // General Page
-class CGeneralPropPageDlg : public CPropertyPage
+class CGeneralPropPageDlg : public TTCPropertyPage
 {
-	DECLARE_DYNAMIC(CGeneralPropPageDlg)
-
 public:
-	CGeneralPropPageDlg();
+	CGeneralPropPageDlg(HINSTANCE inst, TTCPropertySheet *sheet);
 	virtual ~CGeneralPropPageDlg();
-	BOOL OnInitDialog();
+private:
+	void OnInitDialog();
 	void OnOK();
-
 	enum { IDD = IDD_TABSHEET_GENERAL };
-
-private:
-	HFONT DlgGeneralFont;
-	LOGFONT logfont;
-	HFONT font;
-
-protected:
-	DECLARE_MESSAGE_MAP()
 };
 
-
-
 // Control Sequence Page
-class CSequencePropPageDlg : public CPropertyPage
+class CSequencePropPageDlg : public TTCPropertyPage
 {
-	DECLARE_DYNAMIC(CSequencePropPageDlg)
-
 public:
-	CSequencePropPageDlg();
+	CSequencePropPageDlg(HINSTANCE inst, TTCPropertySheet *sheet);
 	virtual ~CSequencePropPageDlg();
-	BOOL OnInitDialog();
+private:
+	void OnInitDialog();
 	void OnOK();
-
 	enum { IDD = IDD_TABSHEET_SEQUENCE };
-
-private:
-	HFONT DlgSequenceFont;
-	LOGFONT logfont;
-	HFONT font;
-
-protected:
-	DECLARE_MESSAGE_MAP()
-	virtual BOOL OnCommand(WPARAM wParam, LPARAM lParam);
+	BOOL OnCommand(WPARAM wParam, LPARAM lParam);
 };
 
-
-
 // Copypaste Page
-class CCopypastePropPageDlg : public CPropertyPage
+class CCopypastePropPageDlg : public TTCPropertyPage
 {
-	DECLARE_DYNAMIC(CCopypastePropPageDlg)
-
 public:
-	CCopypastePropPageDlg();
+	CCopypastePropPageDlg(HINSTANCE inst, TTCPropertySheet *sheet);
 	virtual ~CCopypastePropPageDlg();
-	BOOL OnInitDialog();
+private:
+	void OnInitDialog();
 	void OnOK();
-
 	enum { IDD = IDD_TABSHEET_COPYPASTE };
-
-private:
-	HFONT DlgCopypasteFont;
-	LOGFONT logfont;
-	HFONT font;
-
-protected:
-	DECLARE_MESSAGE_MAP()
-	virtual BOOL OnCommand(WPARAM wParam, LPARAM lParam);
+	BOOL OnCommand(WPARAM wParam, LPARAM lParam);
 };
 
-
-
 // Visual Page
-class CVisualPropPageDlg : public CPropertyPage
+class CVisualPropPageDlg : public TTCPropertyPage
 {
-	DECLARE_DYNAMIC(CVisualPropPageDlg)
-
 public:
-	CVisualPropPageDlg();
+	CVisualPropPageDlg(HINSTANCE inst, TTCPropertySheet *sheet);
 	virtual ~CVisualPropPageDlg();
-	BOOL OnInitDialog();
+private:
+	void OnInitDialog();
 	void OnOK();
-
+	HBRUSH OnCtlColor(HDC hDC, HWND hWnd);
 	enum { IDD = IDD_TABSHEET_VISUAL };
-
-private:
-	HFONT DlgVisualFont;
-	LOGFONT logfont;
-	HFONT font;
-
-protected:
-	DECLARE_MESSAGE_MAP()
-	virtual BOOL OnCommand(WPARAM wParam, LPARAM lParam);
+	BOOL OnCommand(WPARAM wParam, LPARAM lParam);
+	void SetupRGBbox(int index);
 };
 
-
-
 // Log Page
-class CLogPropPageDlg : public CPropertyPage
+class CLogPropPageDlg : public TTCPropertyPage
 {
-	DECLARE_DYNAMIC(CLogPropPageDlg)
-
 public:
-	CLogPropPageDlg();
+	CLogPropPageDlg(HINSTANCE inst, TTCPropertySheet *sheet);
 	virtual ~CLogPropPageDlg();
-	BOOL OnInitDialog();
+private:
+	void OnInitDialog();
 	void OnOK();
-
 	enum { IDD = IDD_TABSHEET_LOG };
-
-private:
-	HFONT DlgLogFont;
-	LOGFONT logfont;
-	HFONT font;
-
-protected:
-	DECLARE_MESSAGE_MAP()
-	virtual BOOL OnCommand(WPARAM wParam, LPARAM lParam);
+	BOOL OnCommand(WPARAM wParam, LPARAM lParam);
 };
 
-
-
 // Cygwin Page
-class CCygwinPropPageDlg : public CPropertyPage
+class CCygwinPropPageDlg : public TTCPropertyPage
 {
-	DECLARE_DYNAMIC(CCygwinPropPageDlg)
-
 public:
-	CCygwinPropPageDlg();
+	CCygwinPropPageDlg(HINSTANCE inst, TTCPropertySheet *sheet);
 	virtual ~CCygwinPropPageDlg();
-	BOOL OnInitDialog();
+private:
+	void OnInitDialog();
 	void OnOK();
-
 	enum { IDD = IDD_TABSHEET_CYGWIN };
-
-private:
-	HFONT DlgCygwinFont;
-	LOGFONT logfont;
-	HFONT font;
 	cygterm_t settings;
-
-protected:
-	DECLARE_MESSAGE_MAP()
-	virtual BOOL OnCommand(WPARAM wParam, LPARAM lParam);
+	BOOL OnCommand(WPARAM wParam, LPARAM lParam);
 };
 
-
-
 // Property Sheet
-class CAddSettingPropSheetDlg : public CPropertySheet
+class CAddSettingPropSheetDlg : public TTCPropertySheet
 {
-	DECLARE_DYNAMIC(CAddSettingPropSheetDlg)
-
 public:
-	CAddSettingPropSheetDlg(UINT nIDCaption, CWnd* pParentWnd = NULL, UINT iSelectPage = 0);
-	CAddSettingPropSheetDlg(LPCTSTR pszCaption, CWnd* pParentWnd = NULL, UINT iSelectPage = 0);
+	CAddSettingPropSheetDlg(HINSTANCE hInstance, LPCTSTR pszCaption, HWND hParentWnd);
 	virtual ~CAddSettingPropSheetDlg();
-	BOOL OnInitDialog();
-
 private:
-	HFONT DlgAdditionalFont;
-	LOGFONT logfont;
-	HFONT font;
-
-protected:
-	DECLARE_MESSAGE_MAP()
-
-public:
-	CGeneralPropPageDlg   m_GeneralPage;
-	CSequencePropPageDlg  m_SequencePage;
-	CCopypastePropPageDlg m_CopypastePage;
-	CVisualPropPageDlg    m_VisualPage;
-	CLogPropPageDlg       m_LogPage;
-	CCygwinPropPageDlg    m_CygwinPage;
+	HPROPSHEETPAGE hPsp[6];
+	
+	CGeneralPropPageDlg   *m_GeneralPage;
+	CSequencePropPageDlg  *m_SequencePage;
+	CCopypastePropPageDlg *m_CopypastePage;
+	CVisualPropPageDlg    *m_VisualPage;
+	CLogPropPageDlg       *m_LogPage;
+	CCygwinPropPageDlg    *m_CygwinPage;
 };

Modified: trunk/teraterm/teraterm/vtwin.cpp
===================================================================
--- trunk/teraterm/teraterm/vtwin.cpp	2019-03-28 16:09:45 UTC (rev 7524)
+++ trunk/teraterm/teraterm/vtwin.cpp	2019-03-28 16:38:16 UTC (rev 7525)
@@ -116,9 +116,6 @@
 
 static int AutoDisconnectedPort = -1;
 
-// \x96{\x91̂\xCD addsetting.cpp
-extern mouse_cursor_t MouseCursor[];
-
 #ifndef WM_IME_COMPOSITION
 #define WM_IME_COMPOSITION              0x010F
 #endif
@@ -4568,11 +4565,10 @@
 {
 	DWORD ret;
 
-	CAddSettingPropSheetDlg CAddSetting("", CWnd::FromHandle(HVTWin));
-	CAddSetting.EnableStackedTabs(FALSE);
+	CAddSettingPropSheetDlg CAddSetting(hInst, _T("Tera Term: Additional settings"), HVTWin);
 	ret = CAddSetting.DoModal();
 	switch (ret) {
-		case -1:
+		case (DWORD)-1:
 		case IDABORT:
 			ret = GetLastError();
 			break;


Ttssh2-commit メーリングリストの案内
Back to archive index