[Ttssh2-commit] [7537] ttpmacroからmfc依存をなくした

scmno****@osdn***** scmno****@osdn*****
2019年 4月 1日 (月) 21:45:27 JST


Revision: 7537
          http://sourceforge.jp/projects/ttssh2/scm/svn/commits/7537
Author:   zmatsuo
Date:     2019-04-01 21:45:26 +0900 (Mon, 01 Apr 2019)
Log Message:
-----------
ttpmacroからmfc依存をなくした

# Conflicts:
#	teraterm/CMakeLists.txt

Modified Paths:
--------------
    trunk/teraterm/CMakeLists.txt
    trunk/teraterm/common/ttlib.h
    trunk/teraterm/ttpmacro/CMakeLists.txt
    trunk/teraterm/ttpmacro/ListDlg.cpp
    trunk/teraterm/ttpmacro/ListDlg.h
    trunk/teraterm/ttpmacro/errdlg.cpp
    trunk/teraterm/ttpmacro/errdlg.h
    trunk/teraterm/ttpmacro/inpdlg.cpp
    trunk/teraterm/ttpmacro/inpdlg.h
    trunk/teraterm/ttpmacro/msgdlg.cpp
    trunk/teraterm/ttpmacro/msgdlg.h
    trunk/teraterm/ttpmacro/statdlg.cpp
    trunk/teraterm/ttpmacro/statdlg.h
    trunk/teraterm/ttpmacro/ttm_res.h
    trunk/teraterm/ttpmacro/ttmacro.cpp
    trunk/teraterm/ttpmacro/ttmacro.h
    trunk/teraterm/ttpmacro/ttmdlg.cpp
    trunk/teraterm/ttpmacro/ttmlib.c
    trunk/teraterm/ttpmacro/ttmlib.h
    trunk/teraterm/ttpmacro/ttmmain.cpp
    trunk/teraterm/ttpmacro/ttmmain.h
    trunk/teraterm/ttpmacro/ttpmacro.rc

Added Paths:
-----------
    trunk/tests/gui_commands_test.ttl
    trunk/tests/gui_commands_test_utf8.ttl

Removed Paths:
-------------
    trunk/teraterm/ttpmacro/stdafx.h

-------------- next part --------------
Modified: trunk/teraterm/CMakeLists.txt
===================================================================
--- trunk/teraterm/CMakeLists.txt	2019-04-01 12:45:02 UTC (rev 7536)
+++ trunk/teraterm/CMakeLists.txt	2019-04-01 12:45:26 UTC (rev 7537)
@@ -14,13 +14,13 @@
   ttpset
   PROPERTIES FOLDER teraterm)
 
-if((NOT(${CMAKE_GENERATOR} MATCHES "Visual Studio 8 2005" AND ${CMAKE_MAKE_PROGRAM} MATCHES "VCExpress.exe")) AND (NOT(MINGW)))
+#if((NOT(${CMAKE_GENERATOR} MATCHES "Visual Studio 8 2005" AND ${CMAKE_MAKE_PROGRAM} MATCHES "VCExpress.exe")) AND (NOT(MINGW)))
   # MFCを使用しているため VS2005 Express ではビルドできない
   add_subdirectory(ttpmacro)
   set_target_properties(
     ttpmacro
     PROPERTIES FOLDER teraterm)
-endif()
+#endif()
 
 add_subdirectory(ttptek)
 set_target_properties(

Modified: trunk/teraterm/common/ttlib.h
===================================================================
--- trunk/teraterm/common/ttlib.h	2019-04-01 12:45:02 UTC (rev 7536)
+++ trunk/teraterm/common/ttlib.h	2019-04-01 12:45:26 UTC (rev 7537)
@@ -121,12 +121,15 @@
 void SetDlgMenuTexts(HMENU hMenu, const DlgTextInfo *infos, int infoCount, const char *UILanguageFile);
 
 #if defined(_UNICODE)
+#define	doSelectFolderT(p1, p2, p3, p4, p5) doSelectFolderW(p1, p2, p3, p4, p5)
 #define	get_lang_msgT(p1, p2, p3, p4, p5) get_lang_msgW(p1, p2, p3, p4, p5)
 #define	get_OPENFILENAME_SIZE() get_OPENFILENAME_SIZEW()
 #else
+#define	doSelectFolderT(p1, p2, p3, p4, p5) doSelectFolder(p1, p2, p3, p4, p5)
 #define	get_lang_msgT(p1, p2, p3, p4, p5) get_lang_msg(p1, p2, p3, p4, p5)
 #define	get_OPENFILENAME_SIZE() get_OPENFILENAME_SIZEA()
 #endif
+
 #ifdef __cplusplus
 }
 #endif

Modified: trunk/teraterm/ttpmacro/CMakeLists.txt
===================================================================
--- trunk/teraterm/ttpmacro/CMakeLists.txt	2019-04-01 12:45:02 UTC (rev 7536)
+++ trunk/teraterm/ttpmacro/CMakeLists.txt	2019-04-01 12:45:26 UTC (rev 7537)
@@ -19,11 +19,21 @@
   ../common/i18n.h
   ../common/ttlib.c
   ../common/ttlib.h
+  ../common/tmfc.cpp
+  ../common/tmfc.h
+  ../common/tmfc_frame.cpp
+  ../common/dlglib.h
+  ../common/dlglib.c
+  ../common/dlglib_tmpl.cpp
+  ../common/dlglib_cpp.cpp
   ../common/compat_w95.h
+  ../common/compat_win.h
+  ../common/compat_win.cpp
   ../common/win16api.h
   ../common/win16api.c
   ../common/codeconv.h
   ../common/codeconv.cpp
+  ../common/dllutil.cpp
   )
 
 source_group(
@@ -44,7 +54,6 @@
   msgdlg.h
   statdlg.cpp
   statdlg.h
-  stdafx.h
   ttl.c
   ttl.h
   ttm_res.h
@@ -88,11 +97,7 @@
   ${SFMT_LIBRARY_DIRS}
   )
 
-set(CMAKE_MFC_FLAG 1)
-
 if (MSVC)
-  set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /NODEFAULTLIB:nafxcw.lib /NODEFAULTLIB:LIBCMT.lib")
-  set(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} /NODEFAULTLIB:nafxcwd.lib /NODEFAULTLIB:LIBCMTD.lib")
   set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /DELAYLOAD:iphlpapi.dll /DELAYLOAD:user32.dll")
 endif()
 
@@ -104,14 +109,12 @@
 target_link_libraries(
   ttpmacro
   ttpcmn
-  optimized nafxcw.lib
-  debug nafxcwd.lib
-  optimized LIBCMT.lib
-  debug LIBCMTD.lib
-  optimized onig.lib
-  debug onigd.lib
-  optimized sfmt.lib
-  debug sfmtd.lib
+#  optimized LIBCMT.lib
+#  debug LIBCMTD.lib
+  optimized onig
+  debug onigd
+  optimized sfmt
+  debug sfmtd
   #
   iphlpapi
   delayimp

Modified: trunk/teraterm/ttpmacro/ListDlg.cpp
===================================================================
--- trunk/teraterm/ttpmacro/ListDlg.cpp	2019-04-01 12:45:02 UTC (rev 7536)
+++ trunk/teraterm/ttpmacro/ListDlg.cpp	2019-04-01 12:45:26 UTC (rev 7537)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2013-2017 TeraTerm Project
+ * Copyright (C) 2013-2019 TeraTerm Project
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -29,23 +29,21 @@
 // ListDlg.cpp : \x8E\xC0\x91\x95\x83t\x83@\x83C\x83\x8B
 //
 
-#include "stdafx.h"
+#include "tmfc.h"
 #include "teraterm.h"
 #include "ttlib.h"
 #include "ttm_res.h"
 #include "ttmlib.h"
 #include "tttypes.h"
+#include "dlglib.h"
+#include "ttmdlg.h"
+#include "ttmacro.h"
 
-#include "stdafx.h"
 #include "ListDlg.h"
 
-
 // CListDlg \x83_\x83C\x83A\x83\x8D\x83O
 
-IMPLEMENT_DYNAMIC(CListDlg, CDialog)
-
 CListDlg::CListDlg(PCHAR Text, PCHAR Caption, CHAR **Lists, int Selected, int x, int y)
-	: CDialog(CListDlg::IDD)
 {
 	m_Text = Text;
 	m_Caption = Caption;
@@ -53,76 +51,41 @@
 	m_Selected = Selected;
 	PosX = x;
 	PosY = y;
-	DlgFont = NULL;
 }
 
-CListDlg::~CListDlg()
+INT_PTR CListDlg::DoModal()
 {
+	HINSTANCE hInst = GetInstance();
+	HWND hWndParent = GetHWND();
+	return TTCDialog::DoModal(hInst, hWndParent, IDD);
 }
 
-void CListDlg::DoDataExchange(CDataExchange* pDX)
-{
-	CDialog::DoDataExchange(pDX);
-	DDX_Control(pDX, IDC_LISTBOX, m_xcList);
-}
-
-
-BEGIN_MESSAGE_MAP(CListDlg, CDialog)
-	ON_BN_CLICKED(IDOK, &CListDlg::OnBnClickedOk)
-	ON_BN_CLICKED(IDCANCEL, &CListDlg::OnBnClickedCancel)
-END_MESSAGE_MAP()
-
-
-// CListDlg \x83\x81\x83b\x83Z\x81[\x83W \x83n\x83\x93\x83h\x83\x89
-
-void CListDlg::OnBnClickedOk()
-{
-	// TODO: \x82\xB1\x82\xB1\x82ɃR\x83\x93\x83g\x83\x8D\x81[\x83\x8B\x92ʒm\x83n\x83\x93\x83h\x83\x89 \x83R\x81[\x83h\x82\xF0\x92lj\xC1\x82\xB5\x82܂\xB7\x81B
-	m_SelectItem = m_xcList.GetCurSel();
-	OnOK();
-}
-
 BOOL CListDlg::OnInitDialog()
 {
+	static const DlgTextInfo TextInfos[] = {
+		{ IDOK, "BTN_YES" },
+		{ IDCANCEL, "BTN_CANCEL" },
+	};
 	char **p;
-	char uimsg[MAX_UIMSG], uimsg2[MAX_UIMSG];
-	LOGFONT logfont;
-	HFONT font, tmpfont;
 	int ListMaxWidth = 0;
 	int ListWidth;
 	int ListCount = 0;
-	CDC *pDC;
-	CFont *pOldFont;
+	HDC DC;
 	RECT R;
 	HDC TmpDC;
 	HWND HList, HOk;
 
-	CDialog::OnInitDialog();
+	SetDlgTexts(m_hWnd, TextInfos, _countof(TextInfos), UILanguageFile);
 
-	// TODO:  \x82\xB1\x82\xB1\x82ɏ\x89\x8A\xFA\x89\xBB\x82\xF0\x92lj\xC1\x82\xB5\x82Ă\xAD\x82\xBE\x82\xB3\x82\xA2
-	font = (HFONT)SendMessage(WM_GETFONT, 0, 0);
-	GetObject(font, sizeof(LOGFONT), &logfont);
-	if (get_lang_font("DLG_SYSTEM_FONT", m_hWnd, &logfont, &DlgFont, UILanguageFile)) {
-		SendDlgItemMessage(IDC_LISTBOX, WM_SETFONT, (WPARAM)DlgFont, MAKELPARAM(TRUE,0));
-		SendDlgItemMessage(IDC_STATIC, WM_SETFONT, (WPARAM)DlgFont, MAKELPARAM(TRUE,0));
-		SendDlgItemMessage(IDOK, WM_SETFONT, (WPARAM)DlgFont, MAKELPARAM(TRUE,0));
-		SendDlgItemMessage(IDCANCEL, WM_SETFONT, (WPARAM)DlgFont, MAKELPARAM(TRUE,0));
-	}
+	HList = ::GetDlgItem(m_hWnd, IDC_LISTBOX);
+	DC = ::GetDC(HList);	// \x83\x8A\x83X\x83g\x83{\x83b\x83N\x83X\x82\xF0\x89\xA1\x83X\x83N\x83\x8D\x81[\x83\x8B\x82ł\xAB\x82\xE9\x82悤\x82ɍő啝\x82\xF0\x8E擾
 
-	GetDlgItemText(IDOK, uimsg2, sizeof(uimsg2));
-	get_lang_msg("BTN_OK", uimsg, sizeof(uimsg), uimsg2, UILanguageFile);
-	SetDlgItemText(IDOK, uimsg);
-	GetDlgItemText(IDCANCEL, uimsg2, sizeof(uimsg2));
-	get_lang_msg("BTN_CANCEL", uimsg, sizeof(uimsg), uimsg2, UILanguageFile);
-	SetDlgItemText(IDCANCEL, uimsg);
-
-	pDC = m_xcList.GetDC(); // \x83\x8A\x83X\x83g\x83{\x83b\x83N\x83X\x82\xF0\x89\xA1\x83X\x83N\x83\x8D\x81[\x83\x8B\x82ł\xAB\x82\xE9\x82悤\x82ɍő啝\x82\xF0\x8E擾
-	pOldFont = pDC->SelectObject(m_xcList.GetFont());
-
 	p = m_Lists;
 	while (*p) {
-		m_xcList.InsertString(-1, _T(*p));
-		ListWidth = pDC->GetTextExtent(*p).cx;
+		SIZE size;
+		SendDlgItemMessage(IDC_LISTBOX, LB_ADDSTRING, 0, (LPARAM)(*p));
+		GetTextExtentPoint32(DC, *p, strlen(*p), &size);
+		ListWidth = size.cx;
 		if (ListWidth > ListMaxWidth) {
 			ListMaxWidth = ListWidth;
 		}
@@ -129,35 +92,25 @@
 		ListCount++;
 		p++;
 	}
-	UpdateData(FALSE);
 
-	m_xcList.SetHorizontalExtent(ListMaxWidth + 5);
-	pDC->SelectObject(pOldFont);
-	ReleaseDC(pDC);
+	SendDlgItemMessage(IDC_LISTBOX, LB_SETHORIZONTALEXTENT, (ListMaxWidth + 5), 0);
+	::ReleaseDC(m_hWnd, DC);
 
 	if (m_Selected < 0 || m_Selected >= ListCount) {
 		m_Selected = 0;
 	}
-	m_xcList.SetCurSel(m_Selected);
+	SetCurSel(IDC_LISTBOX, m_Selected);
 
 	// \x96{\x95\xB6\x82ƃ^\x83C\x83g\x83\x8B
-	SetDlgItemText(IDC_STATIC, m_Text);
+	SetDlgItemText(IDC_LISTTEXT, m_Text);
 	SetWindowText(m_Caption);
 
-
-	TmpDC = ::GetDC(GetDlgItem(IDC_STATIC)->GetSafeHwnd());
-	if (DlgFont) {
-		tmpfont = (HFONT)SelectObject(TmpDC, DlgFont);
-	}
+	TmpDC = ::GetDC(GetDlgItem(IDC_LISTTEXT));
 	CalcTextExtent(TmpDC,m_Text,&s);
-	if (DlgFont && tmpfont != NULL) {
-		SelectObject(TmpDC, tmpfont);
-	}
-	::ReleaseDC(GetDlgItem(IDC_STATIC)->GetSafeHwnd(),TmpDC);
+	::ReleaseDC(GetDlgItem(IDC_LISTTEXT), TmpDC);
 	TW = s.cx + s.cx/10;
 	TH = s.cy;
 
-	HList = ::GetDlgItem(GetSafeHwnd(), IDC_LISTBOX);
 	::GetWindowRect(HList,&R);
 	LW = R.right-R.left;
 	LH = R.bottom-R.top;
@@ -172,19 +125,33 @@
 	WH = R.bottom-R.top;
 
 	Relocation(TRUE, WW);
+	BringupWindow(m_hWnd);
 
-	BringupWindow(this->m_hWnd);
+	return TRUE;
+}
 
-	return TRUE;  // return TRUE unless you set the focus to a control
-	// \x97\xE1\x8AO : OCX \x83v\x83\x8D\x83p\x83e\x83B \x83y\x81[\x83W\x82͕K\x82\xB8 FALSE \x82\xF0\x95Ԃ\xB5\x82܂\xB7\x81B
+BOOL CListDlg::OnOK()
+{
+	m_SelectItem = GetCurSel(IDC_LISTBOX);
+	return TTCDialog::OnOK();
 }
 
-void CListDlg::OnBnClickedCancel()
+BOOL CListDlg::OnCancel()
 {
-	// TODO: \x82\xB1\x82\xB1\x82ɃR\x83\x93\x83g\x83\x8D\x81[\x83\x8B\x92ʒm\x83n\x83\x93\x83h\x83\x89 \x83R\x81[\x83h\x82\xF0\x92lj\xC1\x82\xB5\x82܂\xB7\x81B
-	OnCancel();
+	return TTCDialog::OnCancel();
 }
 
+//int MessageBoxHaltScript(HWND hWnd);
+
+BOOL CListDlg::OnClose()
+{
+	int ret = MessageBoxHaltScript(m_hWnd);
+	if (ret == IDYES) {
+		EndDialog(IDCLOSE);
+	}
+	return TRUE;
+}
+
 void CListDlg::Relocation(BOOL is_init, int new_WW)
 {
 	RECT R;
@@ -192,7 +159,7 @@
 	HWND HText, HOk, HCancel, HList;
 	int CW, CH;
 
-	GetClientRect(&R);
+	::GetClientRect(m_hWnd, &R);
 	CW = R.right-R.left;
 	CH = R.bottom-R.top;
 
@@ -216,7 +183,7 @@
 		WW = new_WW;
 	}
 
-	HText = ::GetDlgItem(GetSafeHwnd(), IDC_STATIC);
+	HText = ::GetDlgItem(GetSafeHwnd(), IDC_LISTTEXT);
 	HOk = ::GetDlgItem(GetSafeHwnd(), IDOK);
 	HCancel = ::GetDlgItem(GetSafeHwnd(), IDCANCEL);
 	HList = ::GetDlgItem(GetSafeHwnd(), IDC_LISTBOX);
@@ -227,13 +194,14 @@
 	::MoveWindow(HCancel,14+14+LW,BH*2,BW,BH,TRUE);
 
 	if (PosX<=GetMonitorLeftmost(PosX, PosY)-100) {
-		GetWindowRect(&R);
+		::GetWindowRect(m_hWnd, &R);
 		TmpDC = ::GetDC(GetSafeHwnd());
 		PosX = (GetDeviceCaps(TmpDC,HORZRES)-R.right+R.left) / 2;
 		PosY = (GetDeviceCaps(TmpDC,VERTRES)-R.bottom+R.top) / 2;
 		::ReleaseDC(GetSafeHwnd(),TmpDC);
 	}
-	SetWindowPos(&wndTop,PosX,PosY,WW,WH,0);
+	::SetWindowPos(m_hWnd, HWND_TOP,PosX,PosY,WW,WH,0);
 
-	InvalidateRect(NULL);
+	::InvalidateRect(m_hWnd, NULL, TRUE);
 }
+

Modified: trunk/teraterm/ttpmacro/ListDlg.h
===================================================================
--- trunk/teraterm/ttpmacro/ListDlg.h	2019-04-01 12:45:02 UTC (rev 7536)
+++ trunk/teraterm/ttpmacro/ListDlg.h	2019-04-01 12:45:26 UTC (rev 7537)
@@ -26,42 +26,28 @@
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 #pragma once
-#include "afxwin.h"
 
-
 // CListDlg \x83_\x83C\x83A\x83\x8D\x83O
-
-class CListDlg : public CDialog
+class CListDlg : public TTCDialog
 {
-	DECLARE_DYNAMIC(CListDlg)
-
 public:
 	CListDlg(PCHAR Text, PCHAR Caption, CHAR **Lists, int Selected, int x, int y);
-	virtual ~CListDlg();
+	INT_PTR DoModal();
+	int m_SelectItem;
 
-// \x83_\x83C\x83A\x83\x8D\x83O \x83f\x81[\x83^
+private:
 	enum { IDD = IDD_LISTDLG };
-
-protected:
 	PCHAR m_Text;
 	PCHAR m_Caption;
 	CHAR **m_Lists;
 	int m_Selected;
-	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV \x83T\x83|\x81[\x83g
 	int PosX, PosY, init_WW, WW, WH, TW, TH, BH, BW, LW, LH;
 	SIZE s;
-	HFONT DlgFont;
 
 	void Relocation(BOOL is_init, int WW);
 
-	DECLARE_MESSAGE_MAP()
-public:
-	CListBox m_xcList;
-	int m_SelectItem;
-public:
-	afx_msg void OnBnClickedOk();
-public:
 	virtual BOOL OnInitDialog();
-public:
-	afx_msg void OnBnClickedCancel();
+	virtual BOOL OnOK();
+	virtual BOOL OnCancel();
+	virtual BOOL OnClose();
 };

Modified: trunk/teraterm/ttpmacro/errdlg.cpp
===================================================================
--- trunk/teraterm/ttpmacro/errdlg.cpp	2019-04-01 12:45:02 UTC (rev 7536)
+++ trunk/teraterm/ttpmacro/errdlg.cpp	2019-04-01 12:45:26 UTC (rev 7537)
@@ -29,7 +29,9 @@
 
 /* TTMACRO.EXE, error dialog box */
 
-#include "stdafx.h"
+#include <windowsx.h>
+#include <stdio.h>
+#include "tmfc.h"
 #include "teraterm.h"
 #include "ttlib.h"
 #include "ttm_res.h"
@@ -41,19 +43,16 @@
 #include "errdlg.h"
 #include "ttmlib.h"
 #include "ttmparse.h"
+#include "htmlhelp.h"
+#include "dlglib.h"
 
-#ifdef _DEBUG
-#define new DEBUG_NEW
-#undef THIS_FILE
-static char THIS_FILE[] = __FILE__;
-#endif
+extern HINSTANCE GetInstance();
+extern HWND GetHWND();
 
 // CErrDlg dialog
+
 CErrDlg::CErrDlg(PCHAR Msg, PCHAR Line, int x, int y, int lineno, int start, int end, PCHAR FileName)
-	: CDialog(CErrDlg::IDD)
 {
-	//{{AFX_DATA_INIT(CErrDlg)
-	//}}AFX_DATA_INIT
 	MsgStr = Msg;
 	LineStr = Line;
 	PosX = x;
@@ -64,44 +63,27 @@
 	MacroFileName = FileName;
 }
 
-BEGIN_MESSAGE_MAP(CErrDlg, CDialog)
-	//{{AFX_MSG_MAP(CErrDlg)
-	//}}AFX_MSG_MAP
-	ON_BN_CLICKED(IDC_MACROERRHELP, &CErrDlg::OnBnClickedMacroerrhelp)
-END_MESSAGE_MAP()
+INT_PTR CErrDlg::DoModal()
+{
+	HINSTANCE hInst = GetInstance();
+	HWND parent = GetHWND();
+	return TTCDialog::DoModal(hInst, parent, CErrDlg::IDD);
+}
 
-// CErrDlg message handler
-
 BOOL CErrDlg::OnInitDialog()
 {
+	static const DlgTextInfo TextInfos[] = {
+		{ IDOK, "BTN_STOP" },
+		{ IDCANCEL, "BTN_CONTINUE" },
+		{ IDC_MACROERRHELP, "BTN_HELP" },
+	};
 	RECT R;
 	HDC TmpDC;
-	char uimsg[MAX_UIMSG], uimsg2[MAX_UIMSG];
-	LOGFONT logfont;
-	HFONT font;
 	char buf[MaxLineLen*2], buf2[10];
 	int i, len;
 
-	CDialog::OnInitDialog();
-	font = (HFONT)SendMessage(WM_GETFONT, 0, 0);
-	GetObject(font, sizeof(LOGFONT), &logfont);
-	if (get_lang_font("DLG_SYSTEM_FONT", m_hWnd, &logfont, &DlgFont, UILanguageFile)) {
-		SendDlgItemMessage(IDC_ERRMSG, WM_SETFONT, (WPARAM)DlgFont, MAKELPARAM(TRUE,0));
-		SendDlgItemMessage(IDC_ERRLINE, WM_SETFONT, (WPARAM)DlgFont, MAKELPARAM(TRUE,0));
-		SendDlgItemMessage(IDOK, WM_SETFONT, (WPARAM)DlgFont, MAKELPARAM(TRUE,0));
-		SendDlgItemMessage(IDCANCEL, WM_SETFONT, (WPARAM)DlgFont, MAKELPARAM(TRUE,0));
-	}
+	SetDlgTexts(m_hWnd, TextInfos, _countof(TextInfos), UILanguageFile);
 
-	GetDlgItemText(IDOK, uimsg2, sizeof(uimsg2));
-	get_lang_msg("BTN_STOP", uimsg, sizeof(uimsg), uimsg2, UILanguageFile);
-	SetDlgItemText(IDOK, uimsg);
-	GetDlgItemText(IDCANCEL, uimsg2, sizeof(uimsg2));
-	get_lang_msg("BTN_CONTINUE", uimsg, sizeof(uimsg), uimsg2, UILanguageFile);
-	SetDlgItemText(IDCANCEL, uimsg);
-	GetDlgItemText(IDC_MACROERRHELP, uimsg2, sizeof(uimsg2));
-	get_lang_msg("BTN_HELP", uimsg, sizeof(uimsg), uimsg2, UILanguageFile);
-	SetDlgItemText(IDC_MACROERRHELP, uimsg);
-
 	SetDlgItemText(IDC_ERRMSG,MsgStr);
 
 	// \x8Ds\x94ԍ\x86\x82\xF0\x90擪\x82ɂ‚\xAF\x82\xE9\x81B
@@ -132,8 +114,8 @@
 		PosY = (GetDeviceCaps(TmpDC,VERTRES)-R.bottom+R.top) / 2;
 		::ReleaseDC(GetSafeHwnd(),TmpDC);
 	}
-	SetWindowPos(&wndTop,PosX,PosY,0,0,SWP_NOSIZE);
-	SetForegroundWindow();
+	SetWindowPos(HWND_TOP, PosX, PosY, 0, 0, SWP_NOSIZE);
+	::SetForegroundWindow(m_hWnd);
 
 	return TRUE;
 }
@@ -142,3 +124,13 @@
 {
 	OpenHelp(HH_HELP_CONTEXT, HlpMacroAppendixesError, UILanguageFile);
 }
+
+BOOL CErrDlg::OnCommand(WPARAM wp, LPARAM lp)
+{
+	const WORD wID = GET_WM_COMMAND_ID(wp, lp);
+	if (wID == IDC_MACROERRHELP) {
+		OnBnClickedMacroerrhelp();
+		return TRUE;
+	}
+	return FALSE;
+}

Modified: trunk/teraterm/ttpmacro/errdlg.h
===================================================================
--- trunk/teraterm/ttpmacro/errdlg.h	2019-04-01 12:45:02 UTC (rev 7536)
+++ trunk/teraterm/ttpmacro/errdlg.h	2019-04-01 12:45:26 UTC (rev 7537)
@@ -30,32 +30,24 @@
 /* TTMACRO.EXE, error dialog box */
 
 // CErrDlg dialog
-class CErrDlg : public CDialog
+#include "tmfc.h"
+
+class CErrDlg : public TTCDialog
 {
 public:
 	CErrDlg(PCHAR Msg, PCHAR Line, int x, int y, int lineno, int start, int end, PCHAR FileName);
+	INT_PTR DoModal();
 
-	//{{AFX_DATA(CErrDlg)
+private:
 	enum { IDD = IDD_ERRDLG };
-	//}}AFX_DATA
 
-	//{{AFX_VIRTUAL(CErrDlg)
-	//}}AFX_VIRTUAL
-
-protected:
 	PCHAR MsgStr, LineStr;
 	int PosX, PosY;
-	HFONT DlgFont;
 	int LineNo;
 	int StartPos, EndPos;
 	PCHAR MacroFileName;
 
-	//{{AFX_MSG(CErrDlg)
 	virtual BOOL OnInitDialog();
-	//}}AFX_MSG
-	DECLARE_MESSAGE_MAP()
-public:
-	afx_msg void OnBnClickedMacroerrhelp();
+	BOOL OnCommand(WPARAM wp, LPARAM lp);
+	void OnBnClickedMacroerrhelp();
 };
-
-typedef CErrDlg *PErrDlg;

Modified: trunk/teraterm/ttpmacro/inpdlg.cpp
===================================================================
--- trunk/teraterm/ttpmacro/inpdlg.cpp	2019-04-01 12:45:02 UTC (rev 7536)
+++ trunk/teraterm/ttpmacro/inpdlg.cpp	2019-04-01 12:45:26 UTC (rev 7537)
@@ -29,28 +29,23 @@
 
 /* TTMACRO.EXE, input dialog box */
 
-#include "stdafx.h"
 #include "teraterm.h"
 #include "ttlib.h"
 #include "ttmdef.h"
 #include "ttm_res.h"
 #include "ttmlib.h"
+#include "dlglib.h"
 
 #include "inpdlg.h"
 
-#ifdef _DEBUG
-#define new DEBUG_NEW
-#undef THIS_FILE
-static char THIS_FILE[] = __FILE__;
-#endif
+extern HINSTANCE GetInstance();
+extern HWND GetHWND();
 
 // CInpDlg dialog
 CInpDlg::CInpDlg(PCHAR Input, PCHAR Text, PCHAR Title,
                  PCHAR Default, BOOL Paswd,
-                 int x, int y) : CDialog(CInpDlg::IDD)
+                 int x, int y)
 {
-	//{{AFX_DATA_INIT(CInpDlg)
-	//}}AFX_DATA_INIT
 	InputStr = Input;
 	TextStr = Text;
 	TitleStr = Title;
@@ -58,62 +53,39 @@
 	PaswdFlag = Paswd;
 	PosX = x;
 	PosY = y;
-	DlgFont = NULL;
 }
 
-BEGIN_MESSAGE_MAP(CInpDlg, CDialog)
-	//{{AFX_MSG_MAP(CInpDlg)
-	ON_MESSAGE(WM_EXITSIZEMOVE, OnExitSizeMove)
-	//}}AFX_MSG_MAP
-END_MESSAGE_MAP()
+INT_PTR CInpDlg::DoModal()
+{
+	HINSTANCE hInst = GetInstance();
+	HWND parent = GetHWND();
+	return TTCDialog::DoModal(hInst, parent, CInpDlg::IDD);
+}
 
-// CInpDlg message handler
-
 // msgdlg \x82̂悤\x82ɁA\x83\x81\x83b\x83Z\x81[\x83W\x82\xAA\x92\xB7\x82\xA2\x8Fꍇ\x82ɂ̓_\x83C\x83A\x83\x8D\x83O\x82\xF0\x8Ag\x82\xB0\x82\xE9\x82悤\x82ɂ\xB5\x82\xBD (2006.7.29 maya)
 BOOL CInpDlg::OnInitDialog()
 {
+	static const DlgTextInfo TextInfos[] = {
+		{ IDOK, "BTN_OK" },
+	};
 	RECT R;
-	HDC TmpDC;
 	HWND HEdit, HOk;
-	char uimsg[MAX_UIMSG], uimsg2[MAX_UIMSG];
-	LOGFONT logfont;
-	HFONT font, tmpfont;
 
-	CDialog::OnInitDialog();
-	font = (HFONT)SendMessage(WM_GETFONT, 0, 0);
-	GetObject(font, sizeof(LOGFONT), &logfont);
-	if (get_lang_font("DLG_SYSTEM_FONT", m_hWnd, &logfont, &DlgFont, UILanguageFile)) {
-		SendDlgItemMessage(IDC_INPTEXT, WM_SETFONT, (WPARAM)DlgFont, MAKELPARAM(TRUE,0));
-		SendDlgItemMessage(IDC_INPEDIT, WM_SETFONT, (WPARAM)DlgFont, MAKELPARAM(TRUE,0));
-		SendDlgItemMessage(IDOK, WM_SETFONT, (WPARAM)DlgFont, MAKELPARAM(TRUE,0));
-	}
-
-	GetDlgItemText(IDOK, uimsg2, sizeof(uimsg2));
-	get_lang_msg("BTN_OK", uimsg, sizeof(uimsg), uimsg2, UILanguageFile);
-	SetDlgItemText(IDOK, uimsg);
-
+	SetDlgTexts(m_hWnd, TextInfos, _countof(TextInfos), UILanguageFile);
 	SetWindowText(TitleStr);
 	SetDlgItemText(IDC_INPTEXT,TextStr);
 	SetDlgItemText(IDC_INPEDIT,DefaultStr);
 
-	TmpDC = ::GetDC(GetDlgItem(IDC_INPTEXT)->GetSafeHwnd());
-	if (DlgFont) {
-		tmpfont = (HFONT)SelectObject(TmpDC, DlgFont);
-	}
-	CalcTextExtent(TmpDC,TextStr,&s);
-	if (DlgFont && tmpfont != NULL) {
-		SelectObject(TmpDC, tmpfont);
-	}
-	::ReleaseDC(GetDlgItem(IDC_INPTEXT)->GetSafeHwnd(),TmpDC);
+	CalcTextExtent2(GetDlgItem(IDC_STATTEXT), NULL, TextStr, &s);
 	TW = s.cx + s.cx/10;
 	TH = s.cy;
 
-	HEdit = ::GetDlgItem(GetSafeHwnd(), IDC_INPEDIT);
+	HEdit = GetDlgItem(IDC_INPEDIT);
 	::GetWindowRect(HEdit,&R);
 	EW = R.right-R.left;
 	EH = R.bottom-R.top;
 
-	HOk = ::GetDlgItem(GetSafeHwnd(), IDOK);
+	HOk = GetDlgItem(IDOK);
 	::GetWindowRect(HOk,&R);
 	BW = R.right-R.left;
 	BH = R.bottom-R.top;
@@ -124,18 +96,19 @@
 
 	Relocation(TRUE, WW);
 
-	BringupWindow(this->m_hWnd);
+	BringupWindow(m_hWnd);
 
 	return TRUE;
 }
 
-void CInpDlg::OnOK()
+BOOL CInpDlg::OnOK()
 {
 	GetDlgItemText(IDC_INPEDIT,InputStr,MaxStrLen-1);
 	EndDialog(IDOK);
+	return TRUE;
 }
 
-LONG CInpDlg::OnExitSizeMove(UINT wParam, LONG lParam)
+LRESULT CInpDlg::OnExitSizeMove(WPARAM wParam, LPARAM lParam)
 {
 	RECT R;
 
@@ -145,7 +118,7 @@
 	}
 	else if (R.bottom-R.top != WH || R.right-R.left < init_WW) {
 		// \x8D\x82\x82\xB3\x82\xAA\x95ύX\x82\xB3\x82ꂽ\x82\xA9\x81A\x8Dŏ\x89\x82\xE6\x82蕝\x82\xAA\x8B\xB7\x82\xAD\x82Ȃ\xC1\x82\xBD\x8Fꍇ\x82͌\xB3\x82ɖ߂\xB7
-		SetWindowPos(&wndTop,R.left,R.top,WW,WH,0);
+		SetWindowPos(HWND_TOP, R.left,R.top,WW,WH,0);
 	}
 	else {
 		// \x82\xBB\x82\xA4\x82łȂ\xAF\x82\xEA\x82΍Ĕz\x92u\x82\xB7\x82\xE9
@@ -152,7 +125,7 @@
 		Relocation(FALSE, R.right-R.left);
 	}
 
-	return CDialog::DefWindowProc(WM_EXITSIZEMOVE,wParam,lParam);
+	return TRUE;
 }
 
 void CInpDlg::Relocation(BOOL is_init, int new_WW)
@@ -185,9 +158,9 @@
 		WW = new_WW;
 	}
 
-	HText = ::GetDlgItem(GetSafeHwnd(), IDC_INPTEXT);
-	HOk = ::GetDlgItem(GetSafeHwnd(), IDOK);
-	HEdit = ::GetDlgItem(GetSafeHwnd(), IDC_INPEDIT);
+	HText = GetDlgItem(IDC_INPTEXT);
+	HOk = GetDlgItem(IDOK);
+	HEdit = GetDlgItem(IDC_INPEDIT);
 
 	::MoveWindow(HText,(TW-s.cx)/2,BH/2,TW,TH,TRUE);
 	::MoveWindow(HEdit,(WW-EW)/2-4,TH+BH,EW,EH,TRUE);
@@ -206,7 +179,16 @@
 		PosY = (GetDeviceCaps(TmpDC,VERTRES)-R.bottom+R.top) / 2;
 		::ReleaseDC(GetSafeHwnd(),TmpDC);
 	}
-	SetWindowPos(&wndTop,PosX,PosY,WW,WH,0);
+	SetWindowPos(HWND_TOP,PosX,PosY,WW,WH,0);
 
-	InvalidateRect(NULL);
+	InvalidateRect(NULL, TRUE);
 }
+
+LRESULT CInpDlg::DlgProc(UINT msg, WPARAM wp, LPARAM lp)
+{
+	switch(msg) {
+	case WM_EXITSIZEMOVE:
+		return OnExitSizeMove(wp, lp);
+	}
+	return FALSE;
+}

Modified: trunk/teraterm/ttpmacro/inpdlg.h
===================================================================
--- trunk/teraterm/ttpmacro/inpdlg.h	2019-04-01 12:45:02 UTC (rev 7536)
+++ trunk/teraterm/ttpmacro/inpdlg.h	2019-04-01 12:45:26 UTC (rev 7537)
@@ -29,33 +29,28 @@
 
 /* TTMACRO.EXE, input dialog box */
 
-class CInpDlg : public CDialog
+#include "../common/tmfc.h"
+
+class CInpDlg : public TTCDialog
 {
 public:
 	CInpDlg(PCHAR Input, PCHAR Text, PCHAR Title,
 	        PCHAR Default, BOOL Paswd,
 	        int x, int y);
+	INT_PTR DoModal();
 
-	//{{AFX_DATA(CInpDlg)
+private:
 	enum { IDD = IDD_INPDLG };
-	//}}AFX_DATA
 
-	//{{AFX_VIRTUAL(CInpDlg)
-	//}}AFX_VIRTUAL
-
-protected:
 	PCHAR InputStr, TextStr, TitleStr, DefaultStr;
 	BOOL PaswdFlag;
 	int PosX, PosY, init_WW, WW, WH, TW, TH, BH, BW, EW, EH;
 	SIZE s;
-	HFONT DlgFont;
 
-	//{{AFX_MSG(CInpDlg)
 	virtual BOOL OnInitDialog();
-	virtual void OnOK();
-	afx_msg LONG OnExitSizeMove(UINT wParam, LONG lParam);
-	//}}AFX_MSG
-	void Relocation(BOOL is_init, int WW);
-	DECLARE_MESSAGE_MAP()
+	virtual BOOL OnOK();
+	virtual LRESULT DlgProc(UINT msg, WPARAM wp, LPARAM lp);
+	LRESULT OnExitSizeMove(WPARAM wp, LPARAM lp);
+ 	void Relocation(BOOL is_init, int WW);
 };
-typedef CInpDlg *PInpDlg;
+

Modified: trunk/teraterm/ttpmacro/msgdlg.cpp
===================================================================
--- trunk/teraterm/ttpmacro/msgdlg.cpp	2019-04-01 12:45:02 UTC (rev 7536)
+++ trunk/teraterm/ttpmacro/msgdlg.cpp	2019-04-01 12:45:26 UTC (rev 7537)
@@ -29,82 +29,63 @@
 
 /* TTMACRO.EXE, message dialog box */
 
-#include "stdafx.h"
+#include <windows.h>
+#include <windowsx.h>
 #include "teraterm.h"
 #include "ttlib.h"
 #include "ttm_res.h"
 #include "ttmlib.h"
+#include "tmfc.h"
+#include "dlglib.h"
+#include "ttmdlg.h"
+#include "ttmacro.h"
 
 #include "msgdlg.h"
 
-#ifdef _DEBUG
-#define new DEBUG_NEW
-#undef THIS_FILE
-static char THIS_FILE[] = __FILE__;
-#endif
-
 // CMsgDlg dialog
 
-CMsgDlg::CMsgDlg(PCHAR Text, PCHAR Title, BOOL YesNo,
-                 int x, int y) : CDialog(CMsgDlg::IDD)
+CMsgDlg::CMsgDlg(const TCHAR *Text, const TCHAR *Title, BOOL YesNo,
+                 int x, int y)
 {
-	//{{AFX_DATA_INIT(CMsgDlg)
-	//}}AFX_DATA_INIT
 	TextStr = Text;
 	TitleStr = Title;
 	YesNoFlag = YesNo;
 	PosX = x;
 	PosY = y;
-	DlgFont = NULL;
 }
 
-BEGIN_MESSAGE_MAP(CMsgDlg, CDialog)
-	//{{AFX_MSG_MAP(CMsgDlg)
-	ON_MESSAGE(WM_EXITSIZEMOVE, OnExitSizeMove)
-	//}}AFX_MSG_MAP
-END_MESSAGE_MAP()
+INT_PTR CMsgDlg::DoModal()
+{
+	HINSTANCE hInst = GetInstance();
+	HWND hWndParent = GetHWND();
+	return TTCDialog::DoModal(hInst, hWndParent, CMsgDlg::IDD);
+}
 
-// CMsgDlg message handler
-
 BOOL CMsgDlg::OnInitDialog()
 {
+	static const DlgTextInfo TextInfosOk[] = {
+		{ IDOK, "BTN_OK" },
+	};
+	static const DlgTextInfo TextInfosYesNo[] = {
+		{ IDOK, "BTN_YES" },
+		{ IDCANCEL, "BTN_NO" },
+	};
 	RECT R;
-	HDC TmpDC;
-	HWND HOk, HNo;
-	char uimsg[MAX_UIMSG], uimsg2[MAX_UIMSG];
-	LOGFONT logfont;
-	HFONT font, tmpfont;
+	HWND HOk;
 
-	CDialog::OnInitDialog();
-	font = (HFONT)SendMessage(WM_GETFONT, 0, 0);
-	GetObject(font, sizeof(LOGFONT), &logfont);
-	if (get_lang_font("DLG_SYSTEM_FONT", m_hWnd, &logfont, &DlgFont, UILanguageFile)) {
-		SendDlgItemMessage(IDC_MSGTEXT, WM_SETFONT, (WPARAM)DlgFont, MAKELPARAM(TRUE,0));
-		SendDlgItemMessage(IDOK, WM_SETFONT, (WPARAM)DlgFont, MAKELPARAM(TRUE,0));
-		SendDlgItemMessage(IDCLOSE, WM_SETFONT, (WPARAM)DlgFont, MAKELPARAM(TRUE,0));
+	if (YesNoFlag) {
+		SetDlgTexts(m_hWnd, TextInfosYesNo, _countof(TextInfosYesNo), UILanguageFile);
+	} else {
+		SetDlgTexts(m_hWnd, TextInfosOk, _countof(TextInfosOk), UILanguageFile);
 	}
 
-	GetDlgItemText(IDOK, uimsg2, sizeof(uimsg2));
-	get_lang_msg("BTN_OK", uimsg, sizeof(uimsg), uimsg2, UILanguageFile);
-	SetDlgItemText(IDOK, uimsg);
-
 	SetWindowText(TitleStr);
 	SetDlgItemText(IDC_MSGTEXT,TextStr);
-
-	TmpDC = ::GetDC(GetDlgItem(IDC_MSGTEXT)->GetSafeHwnd());
-	if (DlgFont) {
-		tmpfont = (HFONT)SelectObject(TmpDC, DlgFont);
-	}
-	CalcTextExtent(TmpDC,TextStr,&s);
-	if (DlgFont && tmpfont != NULL) {
-		SelectObject(TmpDC, tmpfont);
-	}
-	::ReleaseDC(GetDlgItem(IDC_MSGTEXT)->GetSafeHwnd(),TmpDC);
+	CalcTextExtent2(GetDlgItem(IDC_STATTEXT), NULL, TextStr, &s);
 	TW = s.cx + s.cx/10;
 	TH = s.cy;
 
 	HOk = ::GetDlgItem(GetSafeHwnd(), IDOK);
-	HNo = ::GetDlgItem(GetSafeHwnd(), IDCLOSE);
 	::GetWindowRect(HOk,&R);
 	BW = R.right-R.left;
 	BH = R.bottom-R.top;
@@ -120,7 +101,7 @@
 	return TRUE;
 }
 
-LONG CMsgDlg::OnExitSizeMove(UINT wParam, LONG lParam)
+LRESULT CMsgDlg::OnExitSizeMove(WPARAM wParam, LPARAM lParam)
 {
 	RECT R;
 
@@ -130,7 +111,7 @@
 	}
 	else if (R.bottom-R.top != WH || R.right-R.left < init_WW) {
 		// \x8D\x82\x82\xB3\x82\xAA\x95ύX\x82\xB3\x82ꂽ\x82\xA9\x81A\x8Dŏ\x89\x82\xE6\x82蕝\x82\xAA\x8B\xB7\x82\xAD\x82Ȃ\xC1\x82\xBD\x8Fꍇ\x82͌\xB3\x82ɖ߂\xB7
-		SetWindowPos(&wndTop,R.left,R.top,WW,WH,0);
+		SetWindowPos(HWND_TOP,R.left,R.top,WW,WH,0);
 	}
 	else {
 		// \x82\xBB\x82\xA4\x82łȂ\xAF\x82\xEA\x82΍Ĕz\x92u\x82\xB7\x82\xE9
@@ -137,7 +118,7 @@
 		Relocation(FALSE, R.right-R.left);
 	}
 
-	return CDialog::DefWindowProc(WM_EXITSIZEMOVE,wParam,lParam);
+	return TRUE;
 }
 
 void CMsgDlg::Relocation(BOOL is_init, int new_WW)
@@ -146,7 +127,6 @@
 	HDC TmpDC;
 	HWND HText, HOk, HNo;
 	int CW, CH;
-	char uimsg[MAX_UIMSG], uimsg2[MAX_UIMSG];
 
 	GetClientRect(&R);
 	CW = R.right-R.left;
@@ -173,20 +153,10 @@
 
 	HText = ::GetDlgItem(GetSafeHwnd(), IDC_MSGTEXT);
 	HOk = ::GetDlgItem(GetSafeHwnd(), IDOK);
-	HNo = ::GetDlgItem(GetSafeHwnd(), IDCLOSE);
+	HNo = ::GetDlgItem(GetSafeHwnd(), IDCANCEL);
 
 	::MoveWindow(HText,(TW-s.cx)/2, BH/2,TW,TH,TRUE);
 	if (YesNoFlag) {
-		if (is_init) {
-			::SetWindowText(HOk,"&Yes");
-			::SetWindowText(HNo,"&No");
-			GetDlgItemText(IDOK, uimsg2, sizeof(uimsg2));
-			get_lang_msg("BTN_YES", uimsg, sizeof(uimsg), uimsg2, UILanguageFile);
-			::SetWindowText(HOk,uimsg);
-			GetDlgItemText(IDCLOSE, uimsg2, sizeof(uimsg2));
-			get_lang_msg("BTN_NO", uimsg, sizeof(uimsg), uimsg2, UILanguageFile);
-			::SetWindowText(HNo,uimsg);
-		}
 		::MoveWindow(HOk,(2*TW-5*BW)/4,TH+BH,BW,BH,TRUE);
 		::MoveWindow(HNo,(2*TW+BW)/4,TH+BH,BW,BH,TRUE);
 		::ShowWindow(HNo,SW_SHOW);
@@ -201,38 +171,41 @@
 		PosY = (GetDeviceCaps(TmpDC,VERTRES)-WH) / 2;
 		::ReleaseDC(GetSafeHwnd(),TmpDC);
 	}
-	SetWindowPos(&wndTop,PosX,PosY,WW,WH,0);
+	SetWindowPos(HWND_TOP,PosX,PosY,WW,WH,0);
 	InvalidateRect(NULL);
 }
 
-BOOL CMsgDlg::OnCommand(WPARAM wParam, LPARAM lParam)
+BOOL CMsgDlg::OnCancel()
 {
-	switch (LOWORD(wParam)) {
-	case IDCANCEL:
-		if( HIWORD(wParam) == BN_CLICKED ) {
-			// \x83\x81\x83b\x83Z\x81[\x83W\x83{\x83b\x83N\x83X\x82\xF0\x83L\x83\x83\x83\x93\x83Z\x83\x8B\x82\xB7\x82\xE9\x82ƁA\x83}\x83N\x83\x8D\x82̏I\x97\xB9\x82Ƃ\xB7\x82\xE9\x81B
-			// (2008.8.5 yutaka)	
-			int ret;
-			char uimsg[MAX_UIMSG], uimsg2[MAX_UIMSG];
-			get_lang_msg("MSG_MACRO_CONF", uimsg, sizeof(uimsg), "MACRO: confirmation", UILanguageFile);
-			get_lang_msg("MSG_MACRO_HALT_SCRIPT", uimsg2, sizeof(uimsg2), "Are you sure that you want to halt this macro script?", UILanguageFile);
-			ret = MessageBox(uimsg2, uimsg, MB_YESNO | MB_ICONWARNING | MB_DEFBUTTON2);
-			if (ret == IDYES) {
-				if (YesNoFlag == TRUE) {
-					EndDialog(IDCLOSE);
-				} else {
-					EndDialog(IDCANCEL);
-				}
-			}
-			return TRUE;
-		}
-		return FALSE;
-
-	case IDCLOSE:
-		EndDialog(IDCANCEL);
+	if (!YesNoFlag) {
+		// ok(yes)\x82\xBE\x82\xAF\x82̂Ƃ\xAB\x82́Acancel\x8F\x88\x97\x9D\x82͉\xBD\x82\xE0\x82\xB5\x82Ȃ\xA2
 		return TRUE;
+	} else {
+		// yes/no\x82̂Ƃ\xAB\x82́A\x83f\x83t\x83H\x83\x8B\x83g\x8F\x88\x97\x9D(\x8FI\x97\xB9)
+		return TTCDialog::OnCancel();
+	}
+}
 
-	default:
-		return (CDialog::OnCommand(wParam,lParam));
+// \x83\x81\x83b\x83Z\x81[\x83W\x83{\x83b\x83N\x83X\x82\xF0\x83L\x83\x83\x83\x93\x83Z\x83\x8B\x82\xB7\x82\xE9(close\x83{\x83^\x83\x93\x82\xF0\x89\x9F\x82\xB7)\x82ƁA\x83}\x83N\x83\x8D\x82̏I\x97\xB9\x82Ƃ\xB7\x82\xE9\x81B
+// (2008.8.5 yutaka)	
+BOOL CMsgDlg::OnClose()
+{
+	const int ret = MessageBoxHaltScript(m_hWnd);
+	if (ret == IDYES) {
+		if (YesNoFlag == TRUE) {
+			EndDialog(IDCLOSE);
+		} else {
+			EndDialog(IDCANCEL);
+		}
 	}
+	return TRUE;
 }
+
+LRESULT CMsgDlg::DlgProc(UINT msg, WPARAM wp, LPARAM lp)
+{
+	switch(msg) {
+	case WM_EXITSIZEMOVE:
+		return OnExitSizeMove(wp, lp);
+	}
+	return FALSE;
+}

Modified: trunk/teraterm/ttpmacro/msgdlg.h
===================================================================
--- trunk/teraterm/ttpmacro/msgdlg.h	2019-04-01 12:45:02 UTC (rev 7536)
+++ trunk/teraterm/ttpmacro/msgdlg.h	2019-04-01 12:45:26 UTC (rev 7537)
@@ -29,31 +29,28 @@
 
 /* TTMACRO.EXE, message dialog box */
 
-class CMsgDlg : public CDialog
+#include "ttm_res.h"
+
+class CMsgDlg : public TTCDialog
 {
 public:
-	CMsgDlg(PCHAR Text, PCHAR Title, BOOL YesNo,
-	        int x, int y);
+	CMsgDlg(const TCHAR *Text, const TCHAR *Title, BOOL YesNo, int x, int y);
+	INT_PTR DoModal();
 
-	//{{AFX_DATA(CMsgDlg)
+private:
 	enum { IDD = IDD_MSGDLG };
-	//}}AFX_DATA
 
-	//{{AFX_VIRTUAL(CMsgDlg)
-	virtual BOOL OnCommand(WPARAM wParam, LPARAM lParam);
-	//}}AFX_VIRTUAL
-
-protected:
-	PCHAR TextStr, TitleStr;
+	const TCHAR *TextStr;
+	const TCHAR *TitleStr;
 	BOOL YesNoFlag;
 	int  PosX, PosY, init_WW, WW, WH, TW, TH, BH, BW;
 	SIZE s;
-	HFONT DlgFont;
 
-	//{{AFX_MSG(CMsgDlg)
 	virtual BOOL OnInitDialog();
-	afx_msg LONG OnExitSizeMove(UINT wParam, LONG lParam);
-	//}}AFX_MSG
+	virtual BOOL OnClose();
+	virtual BOOL OnCancel();
+	virtual LRESULT DlgProc(UINT msg, WPARAM wp, LPARAM lp);
+
+	LRESULT OnExitSizeMove(WPARAM wParam, LPARAM lParam);
 	void Relocation(BOOL is_init, int WW);
-	DECLARE_MESSAGE_MAP()
 };

Modified: trunk/teraterm/ttpmacro/statdlg.cpp
===================================================================
--- trunk/teraterm/ttpmacro/statdlg.cpp	2019-04-01 12:45:02 UTC (rev 7536)
+++ trunk/teraterm/ttpmacro/statdlg.cpp	2019-04-01 12:45:26 UTC (rev 7537)
@@ -29,30 +29,22 @@
 
 /* TTMACRO.EXE, status dialog box */
 
-#include "stdafx.h"
+#include <assert.h>
+#include <crtdbg.h>
 #include "teraterm.h"
 #include "ttlib.h"
 #include "ttm_res.h"
 #include "ttmlib.h"
+#include "tmfc.h"
+#include "tttypes.h"
 
 #include "statdlg.h"
-#include "tttypes.h"
 
-#ifdef _DEBUG
-#define new DEBUG_NEW
-#undef THIS_FILE
-static char THIS_FILE[] = __FILE__;
-#endif
-
 // CStatDlg dialog
 
-BEGIN_MESSAGE_MAP(CStatDlg, CDialog)
-	//{{AFX_MSG_MAP(CStatDlg)
-	ON_MESSAGE(WM_EXITSIZEMOVE, OnExitSizeMove)
-	ON_MESSAGE(WM_USER_MSTATBRINGUP, OnSetForceForegroundWindow)
-	//}}AFX_MSG_MAP
-END_MESSAGE_MAP()
 
+extern HINSTANCE GetInstance();
+
 BOOL CStatDlg::Create(PCHAR Text, PCHAR Title, int x, int y)
 {
 	TextStr = Text;
@@ -59,15 +51,13 @@
 	TitleStr = Title;
 	PosX = x;
 	PosY = y;
-	DlgFont = NULL;
-	return CDialog::Create(CStatDlg::IDD, GetDesktopWindow());
+	HINSTANCE hInst = GetInstance();
+	return TTCDialog::Create(hInst, GetDesktopWindow(), CStatDlg::IDD);
 }
 
 void CStatDlg::Update(PCHAR Text, PCHAR Title, int x, int y)
 {
 	RECT R;
-	HDC TmpDC;
-	HFONT tmpfont;
 
 	if (Title!=NULL) {
 		SetWindowText(Title);
@@ -81,17 +71,12 @@
 	WH = R.bottom-R.top;
 
 	if (Text!=NULL) {
-		TmpDC = ::GetDC(GetDlgItem(IDC_STATTEXT)->GetSafeHwnd());
-		if (DlgFont) {
-			tmpfont = (HFONT)SelectObject(TmpDC, DlgFont);
-		}
-		CalcTextExtent(TmpDC,Text,&s);
-		if (DlgFont && tmpfont != NULL) {
-			SelectObject(TmpDC, tmpfont);
-		}
-		::ReleaseDC(GetDlgItem(IDC_STATTEXT)->GetSafeHwnd(),TmpDC);
-		TW = s.cx + s.cx/10;
-		TH = s.cy;
+		SIZE textSize;
+		HWND hWnd = GetDlgItem(IDC_STATTEXT);
+		CalcTextExtent2(hWnd, NULL, Text, &textSize);
+		TW = textSize.cx + textSize.cx/10;	// (cx * (1+0.1)) ?
+		TH = textSize.cy;
+		s = textSize;			// TODO s!?
 
 		SetDlgItemText(IDC_STATTEXT,Text);
 		TextStr = Text;
@@ -109,66 +94,56 @@
 
 BOOL CStatDlg::OnInitDialog()
 {
-	LOGFONT logfont;
-	HFONT font;
 
-	CDialog::OnInitDialog();
 	Update(TextStr,TitleStr,PosX,PosY);
-	SetForegroundWindow();
+	SetForegroundWindow(m_hWnd);
+	return TRUE;
+}
 
-	font = (HFONT)SendMessage(WM_GETFONT, 0, 0);
-	GetObject(font, sizeof(LOGFONT), &logfont);
-	if (get_lang_font("DLG_SYSTEM_FONT", m_hWnd, &logfont, &DlgFont, UILanguageFile)) {
-		SendDlgItemMessage(IDC_STATTEXT, WM_SETFONT, (WPARAM)DlgFont, MAKELPARAM(TRUE,0));
-	}
-
+BOOL CStatDlg::OnOK()
+{
 	return TRUE;
 }
 
-void CStatDlg::OnCancel()
+BOOL CStatDlg::OnCancel()
 {
 	DestroyWindow();
+	return TRUE;
 }
 
 BOOL CStatDlg::OnCommand(WPARAM wParam, LPARAM lParam)
 {
 	switch (LOWORD(wParam)) {
-		case IDOK:  // Enter key\x89\x9F\x89\xBA\x82ŏ\xC1\x82\xA6\x82Ȃ\xA2\x82悤\x82ɂ\xB7\x82\xE9\x81B(2010.8.25 yutaka)
-			return TRUE;
-		case IDCANCEL:
-			if ((HWND)lParam!=NULL) { // ignore ESC key
-				DestroyWindow();
-			}
-			return TRUE;
-		default:
-		return (CDialog::OnCommand(wParam,lParam));
+	case IDOK:
+		// Enter key\x89\x9F\x89\xBA\x82ŏ\xC1\x82\xA6\x82Ȃ\xA2\x82悤\x82ɂ\xB7\x82\xE9\x81B(2010.8.25 yutaka)
+		return TRUE;
+	case IDCANCEL:
+		if ((HWND)lParam!=NULL) { // ignore ESC key
+			DestroyWindow();
+		}
+		return TRUE;
+	default:
+		return FALSE;
 	}
 }
 
-void CStatDlg::PostNcDestroy()
+BOOL CStatDlg::PostNcDestroy()
 {
-	// statusbox\x82\xC6closesbox\x82\xF0\x8CJ\x82\xE8\x95Ԃ\xB7\x82ƁAGDI\x83\x8A\x83\\x81[\x83X\x83\x8A\x81[\x83N\x82ƂȂ\xE9\x96\xE2\x91\xE8\x82\xF0\x8FC\x90\xB3\x82\xB5\x82\xBD\x81B
-	//   - CreateFontIndirect()\x82ō쐬\x82\xB5\x82\xBD\x98_\x97\x9D\x83t\x83H\x83\x93\x83g\x82\xF0\x8D폜\x82\xB7\x82\xE9\x81B
-	// (2016.10.5 yutaka)
-	if (DlgFont) {
-		DeleteObject(DlgFont);
-		DlgFont = NULL;
-	}
-
 	delete this;
+	return TRUE;
 }
 
-LONG CStatDlg::OnExitSizeMove(UINT wParam, LONG lParam)
+LRESULT CStatDlg::OnExitSizeMove(WPARAM wParam, LPARAM lParam)
 {
 	RECT R;
 
-	GetWindowRect(&R);
+	::GetWindowRect(m_hWnd, &R);
 	if (R.bottom-R.top == WH && R.right-R.left == WW) {
 		// \x83T\x83C\x83Y\x82\xAA\x95ς\xED\x82\xC1\x82Ă\xA2\x82Ȃ\xAF\x82\xEA\x82Ή\xBD\x82\xE0\x82\xB5\x82Ȃ\xA2
 	}
 	else if (R.bottom-R.top != WH || R.right-R.left < init_WW) {
 		// \x8D\x82\x82\xB3\x82\xAA\x95ύX\x82\xB3\x82ꂽ\x82\xA9\x81A\x8Dŏ\x89\x82\xE6\x82蕝\x82\xAA\x8B\xB7\x82\xAD\x82Ȃ\xC1\x82\xBD\x8Fꍇ\x82͌\xB3\x82ɖ߂\xB7
-		SetWindowPos(&wndTop,R.left,R.top,WW,WH,0);
+		::SetWindowPos(m_hWnd, HWND_TOP, R.left,R.top,WW,WH,0);
 	}
 	else {
 		// \x82\xBB\x82\xA4\x82łȂ\xAF\x82\xEA\x82΍Ĕz\x92u\x82\xB7\x82\xE9
@@ -175,10 +150,10 @@
 		Relocation(FALSE, R.right-R.left);
 	}
 
-	return CDialog::DefWindowProc(WM_EXITSIZEMOVE,wParam,lParam);
+	return TRUE;
 }
 
-LONG CStatDlg::OnSetForceForegroundWindow(UINT wParam, LONG lParam)
+LRESULT CStatDlg::OnSetForceForegroundWindow(WPARAM wParam, LPARAM lParam)
 {
 	DWORD pid;
 	DWORD targetid;
@@ -188,12 +163,12 @@
 	targetid = GetWindowThreadProcessId(hwnd, &pid);
 	currentActiveThreadId = GetWindowThreadProcessId(::GetForegroundWindow(), &pid);
 
-	SetForegroundWindow();
+	::SetForegroundWindow(m_hWnd);
 	if (targetid == currentActiveThreadId) {
-		BringWindowToTop();
+		BringWindowToTop(m_hWnd);
 	} else {
 		AttachThreadInput(targetid, currentActiveThreadId, TRUE);
-		BringWindowToTop();
+		BringWindowToTop(m_hWnd);
 		AttachThreadInput(targetid, currentActiveThreadId, FALSE);
 	}
 
@@ -208,7 +183,7 @@
 	int CW, CH;
 
 	if (TextStr != NULL) {
-		HText = ::GetDlgItem(GetSafeHwnd(), IDC_STATTEXT);
+		HText = GetDlgItem(IDC_STATTEXT);
 
 		GetClientRect(&R);
 		CW = R.right-R.left;
@@ -239,14 +214,14 @@
 		PosY = (GetDeviceCaps(TmpDC,VERTRES)-WH) / 2;
 		::ReleaseDC(GetSafeHwnd(),TmpDC);
 	}
-	SetWindowPos(&wndTop,PosX,PosY,WW,WH,SWP_NOZORDER);
+	SetWindowPos(HWND_TOP,PosX,PosY,WW,WH,SWP_NOZORDER);
 
-	InvalidateRect(NULL);
+	InvalidateRect(NULL, TRUE);
 }
 
 void CStatDlg::Bringup()
 {
-	BringupWindow(this->m_hWnd);
+	BringupWindow(m_hWnd);
 }
 
 BOOL CStatDlg::CheckAutoCenter()
@@ -255,3 +230,15 @@
 	// Don't call CenterWindow()
 	return FALSE;
 }
+
+LRESULT CStatDlg::DlgProc(UINT msg, WPARAM wp, LPARAM lp)
+{
+	switch(msg) {
+	case WM_USER_MSTATBRINGUP:
+		return OnSetForceForegroundWindow(wp, lp);
+	case WM_EXITSIZEMOVE :
+		return OnExitSizeMove(wp, lp);
+	}
+	return FALSE;
+}
+

Modified: trunk/teraterm/ttpmacro/statdlg.h
===================================================================
--- trunk/teraterm/ttpmacro/statdlg.h	2019-04-01 12:45:02 UTC (rev 7536)
+++ trunk/teraterm/ttpmacro/statdlg.h	2019-04-01 12:45:26 UTC (rev 7537)
@@ -29,38 +29,29 @@
 
 /* TTMACRO.EXE, status dialog box */
 
-class CStatDlg : public CDialog
+class CStatDlg : public TTCDialog
 {
 public:
 	BOOL Create(PCHAR Text, PCHAR Title, int x, int y);
 	void Update(PCHAR Text, PCHAR Title, int x, int y);
 	void Bringup();
-	virtual BOOL CheckAutoCenter();
-
-	//{{AFX_DATA(CStatDlg)
 	enum { IDD = IDD_STATDLG };
-	//}}AFX_DATA
-
-	//{{AFX_VIRTUAL(CStatDlg)
-	protected:
-	virtual void OnCancel( );
-	virtual BOOL OnCommand(WPARAM wParam, LPARAM lParam);
-	virtual void PostNcDestroy();
-	//}}AFX_VIRTUAL
-
-protected:
+private:
 	PCHAR TextStr, TitleStr;
 	int  PosX, PosY, init_WW, WW, WH, TW, TH;
 	SIZE s;
-	HFONT DlgFont;
 
-	//{{AFX_MSG(CStatDlg)
 	virtual BOOL OnInitDialog();
-	afx_msg LONG OnExitSizeMove(UINT wParam, LONG lParam);
-	afx_msg LONG OnSetForceForegroundWindow(UINT wParam, LONG lParam);
-	//}}AFX_MSG
+	virtual BOOL OnOK();
+	virtual BOOL OnCancel();
+	virtual BOOL OnCommand(WPARAM wParam, LPARAM lParam);
+	virtual BOOL PostNcDestroy();
+	virtual LRESULT DlgProc(UINT msg, WPARAM wp, LPARAM lp);
+
+	LRESULT OnExitSizeMove(WPARAM wParam, LPARAM lParam);
+	LRESULT OnSetForceForegroundWindow(WPARAM wParam, LPARAM lParam);
+
 	void Relocation(BOOL is_init, int WW);
-	DECLARE_MESSAGE_MAP()
+
+	BOOL CheckAutoCenter();
 };
-
-typedef CStatDlg *PStatDlg;

Deleted: trunk/teraterm/ttpmacro/stdafx.h
===================================================================
--- trunk/teraterm/ttpmacro/stdafx.h	2019-04-01 12:45:02 UTC (rev 7536)
+++ trunk/teraterm/ttpmacro/stdafx.h	2019-04-01 12:45:26 UTC (rev 7537)
@@ -1,29 +0,0 @@
-/*
- * Copyright (C) 2013-2017 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.
- */
-#pragma once
-#include <afxwin.h>

Modified: trunk/teraterm/ttpmacro/ttm_res.h
===================================================================
--- trunk/teraterm/ttpmacro/ttm_res.h	2019-04-01 12:45:02 UTC (rev 7536)
+++ trunk/teraterm/ttpmacro/ttm_res.h	2019-04-01 12:45:26 UTC (rev 7537)
@@ -21,17 +21,17 @@
 #define IDI_TTMACRO_3D                  601
 #define IDC_LISTBOX                     602
 #define IDC_MACROERRHELP                603
-#define IDC_EDIT1                       604
-#define IDC_EDIT_ERRLINE                604
-#define IDC_FILENAME                    605
+#define IDC_LISTTEXT                    604
+#define IDC_EDIT_ERRLINE                605
+#define IDC_FILENAME                    606
 
 // Next default values for new objects
 // 
 #ifdef APSTUDIO_INVOKED
 #ifndef APSTUDIO_READONLY_SYMBOLS
-#define _APS_NEXT_RESOURCE_VALUE        602
+#define _APS_NEXT_RESOURCE_VALUE        607
 #define _APS_NEXT_COMMAND_VALUE         32771
-#define _APS_NEXT_CONTROL_VALUE         606
+#define _APS_NEXT_CONTROL_VALUE         607
 #define _APS_NEXT_SYMED_VALUE           101
 #endif
 #endif

Modified: trunk/teraterm/ttpmacro/ttmacro.cpp
===================================================================
--- trunk/teraterm/ttpmacro/ttmacro.cpp	2019-04-01 12:45:02 UTC (rev 7536)
+++ trunk/teraterm/ttpmacro/ttmacro.cpp	2019-04-01 12:45:26 UTC (rev 7537)
@@ -29,7 +29,10 @@
 
 /* TTMACRO.EXE, main */
 
-#include "stdafx.h"
+#include <stdio.h>
+#include <crtdbg.h>
+#include <windows.h>
+#include <commctrl.h>
 #include "teraterm.h"
 #include "ttm_res.h"
 #include "ttmmain.h"
@@ -40,25 +43,20 @@
 #include "ttlib.h"
 
 #include "compat_w95.h"
+#include "compat_win.h"
+#include "ttmdlg.h"
+#include "tmfc.h"
 
 #ifdef _DEBUG
-#define new DEBUG_NEW
-#undef THIS_FILE
-static char THIS_FILE[] = __FILE__;
+#define new new(_NORMAL_BLOCK, __FILE__, __LINE__)
 #endif
 
 char UILanguageFile[MAX_PATH];
+static BOOL Busy;
+static HINSTANCE hInst;
+static CCtrlWindow *pCCtrlWindow;
 
-/////////////////////////////////////////////////////////////////////////////
-
-BEGIN_MESSAGE_MAP(CCtrlApp, CWinApp)
-	//{{AFX_MSG_MAP(CCtrlApp)
-	//}}AFX_MSG
-END_MESSAGE_MAP()
-
-/////////////////////////////////////////////////////////////////////////////
-
-CCtrlApp::CCtrlApp()
+static void init()
 {
 	typedef BOOL (WINAPI *pSetDllDir)(LPCSTR);
 	typedef BOOL (WINAPI *pSetDefDllDir)(DWORD);
@@ -78,55 +76,129 @@
 			(*setDllDir)("");
 		}
 	}
+
+	WinCompatInit();
+	if (pSetThreadDpiAwarenessContext) {
+		pSetThreadDpiAwarenessContext(DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2);
+	}
 }
 
-/////////////////////////////////////////////////////////////////////////////
+// TTMACRO main engine
+static BOOL OnIdle(LONG lCount)
+{
+	BOOL Continue;
 
-CCtrlApp theApp;
+	// Avoid multi entry
+	if (Busy) {
+		return FALSE;
+	}
+	Busy = TRUE;
+	if (pCCtrlWindow != NULL) {
+		Continue = pCCtrlWindow->OnIdle();
+	}
+	else {
+		Continue = FALSE;
+	}
+	Busy = FALSE;
+	return Continue;
+}
 
 /////////////////////////////////////////////////////////////////////////////
 
+// CCtrlApp theApp;
 
+static HWND CtrlWnd;
 
-BOOL CCtrlApp::InitInstance()
+HINSTANCE GetInstance()
 {
+	return hInst;
+}
+
+HWND GetHWND()
+{
+	return CtrlWnd;
+}
+
+/////////////////////////////////////////////////////////////////////////////
+
+int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPreInst,
+                   LPSTR lpszCmdLine, int nCmdShow)
+{
+	hInst = hInstance;
 	static HMODULE HTTSET = NULL;
+	LONG lCount = 0;
+	DWORD SleepTick = 1;
 
+#ifdef _DEBUG
+	::_CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF);
+#endif
+
+	init();
+//	InitCommonControls();
 	GetUILanguageFile(UILanguageFile, sizeof(UILanguageFile));
 
 	Busy = TRUE;
-	m_pMainWnd = new CCtrlWindow();
-	PCtrlWindow(m_pMainWnd)->Create();
+	pCCtrlWindow = new CCtrlWindow();
+	pCCtrlWindow->Create();
+//	pCCtrlWindow->ShowWindow(SW_SHOW);
+//	tmpWnd->ShowWindow(SW_SHOW);
 	Busy = FALSE;  
-	return TRUE;
-}
 
-int CCtrlApp::ExitInstance()
-{
-	//delete m_pMainWnd;
-	if (m_pMainWnd) {
-		m_pMainWnd->DestroyWindow();
+	HWND hWnd = pCCtrlWindow->GetSafeHwnd();
+	CtrlWnd = hWnd;
+
+	//////////////////////////////////////////////////////////////////////
+	MSG msg;
+	while (GetMessage(&msg, NULL, 0, 0)) {
+#if 0
+		bool message_processed = false;
+		if (m_pMainWnd->m_hAccel != NULL) {
+			if (!MetaKey(ts.MetaKey)) {
+				// matakey\x82\xAA\x89\x9F\x82\xB3\x82\xEA\x82Ă\xA2\x82Ȃ\xA2
+				if (TranslateAccelerator(m_pMainWnd->m_hWnd , m_pMainWnd->m_hAccel, &msg)) {
+					// \x83A\x83N\x83Z\x83\x89\x83\x8C\x81[\x83^\x81[\x83L\x81[\x82\xF0\x8F\x88\x97\x9D\x82\xB5\x82\xBD
+					message_processed = true;
+				}
+			}
+		}
+#endif
+
+		if (IsDialogMessage(hWnd, &msg) != 0) {
+			/* \x8F\x88\x97\x9D\x82\xB3\x82ꂽ*/
+		} else {
+			TranslateMessage(&msg);
+			DispatchMessage(&msg);
+		}
+#if 0
+		if (!message_processed) {
+			TranslateMessage(&msg);
+			DispatchMessage(&msg);
+		}
+#endif
+
+		while (!PeekMessage(&msg, NULL, NULL, NULL, PM_NOREMOVE)) {
+			// \x83\x81\x83b\x83Z\x81[\x83W\x82\xAA\x82Ȃ\xA2
+			if (!OnIdle(lCount)) {
+				// idle\x95s\x97v
+				if (SleepTick < 500) {	// \x8Dő\xE5 501ms\x96\xA2\x96\x9E
+					SleepTick += 2;
+				}
+				lCount = 0;
+				Sleep(SleepTick);
+			} else {
+				// \x97vidle
+				SleepTick = 0;
+				lCount++;
+			}
+		}
 	}
-	m_pMainWnd = NULL;
-	return ExitCode;
-}
 
-// TTMACRO main engine
-BOOL CCtrlApp::OnIdle(LONG lCount)
-{
-	BOOL Continue;
+	//////////////////////////////////////////////////////////////////////
 
-	// Avoid multi entry
-	if (Busy) {
-		return FALSE;
+	// TODO \x82\xB7\x82łɕ‚\xB6\x82\xE7\x82\xEA\x82Ă\xA2\x82\xE9\x81A\x82\xB1\x82̏\x88\x97\x9D\x95s\x97v?
+	if (pCCtrlWindow) {
+		pCCtrlWindow->DestroyWindow();
 	}
-	Busy = TRUE;
-	if (m_pMainWnd != NULL) {
-		Continue = PCtrlWindow(m_pMainWnd)->OnIdle();
-	}
-	else {
-		Continue = FALSE;
-	}
-	Busy = FALSE;
-	return Continue;
+	pCCtrlWindow = NULL;
+	return ExitCode;
 }

Modified: trunk/teraterm/ttpmacro/ttmacro.h
===================================================================
--- trunk/teraterm/ttpmacro/ttmacro.h	2019-04-01 12:45:02 UTC (rev 7536)
+++ trunk/teraterm/ttpmacro/ttmacro.h	2019-04-01 12:45:26 UTC (rev 7537)
@@ -32,6 +32,7 @@
 /////////////////////////////////////////////////////////////////////////////
 // CCtrlApp:
 
+#if 0
 class CCtrlApp : public CWinApp
 {
 public:
@@ -49,3 +50,7 @@
 	//}}AFX_MSG
 	DECLARE_MESSAGE_MAP()
 };
+#endif
+
+HINSTANCE GetInstance();
+HWND GetHWND();

Modified: trunk/teraterm/ttpmacro/ttmdlg.cpp
===================================================================
--- trunk/teraterm/ttpmacro/ttmdlg.cpp	2019-04-01 12:45:02 UTC (rev 7536)
+++ trunk/teraterm/ttpmacro/ttmdlg.cpp	2019-04-01 12:45:26 UTC (rev 7537)
@@ -29,13 +29,16 @@
 
 /* TTMACRO.EXE, dialog boxes */
 
-#include "stdafx.h"
+#include <windows.h>
+#include <direct.h>
+#include <commdlg.h>
+#include <crtdbg.h>
+#include <assert.h>
+
 #include "teraterm.h"
-#include <direct.h>
 #include "ttm_res.h"
 #include "tttypes.h"
 #include "ttlib.h"
-#include <commdlg.h>
 #include "ttmdef.h"
 #include "errdlg.h"
 #include "inpdlg.h"
@@ -43,8 +46,20 @@
 #include "statdlg.h"
 #include "ListDlg.h"
 #include "ttmlib.h"
+#include "ttmdlg.h"
 
-extern "C" {
+#ifdef _DEBUG
+#define malloc(l)     _malloc_dbg((l), _NORMAL_BLOCK, __FILE__, __LINE__)
+#define realloc(p, l) _realloc_dbg((p), (l), _NORMAL_BLOCK, __FILE__, __LINE__)
+#define calloc(c, s)  _calloc_dbg((c), (s), _NORMAL_BLOCK, __FILE__, __LINE__)
+#define free(p)       _free_dbg((p), _NORMAL_BLOCK, __FILE__, __LINE__)
+#define strdup(s)	  _strdup_dbg((s), _NORMAL_BLOCK, __FILE__, __LINE__)
+#define _strdup(s)	  _strdup_dbg((s), _NORMAL_BLOCK, __FILE__, __LINE__)
+#endif
+
+extern HINSTANCE GetInstance();
+extern HWND GetHWND();
+
 char HomeDir[MAXPATHLEN];
 char FileName[MAX_PATH];
 char TopicName[11];
@@ -53,14 +68,12 @@
 int ParamCnt;
 int ParamsSize;
 BOOL SleepFlag;
-}
 
 static int DlgPosX = -10000;
 static int DlgPosY = 0;
 
-static PStatDlg StatDlg = NULL;
+static CStatDlg *StatDlg = NULL;
 
-extern "C" {
 void ParseParam(PBOOL IOption, PBOOL VOption)
 {
 	int dirlen, fnpos;
@@ -69,7 +82,7 @@
 	PCHAR start, cur, next;
 
 	// Get home directory
-	if (GetModuleFileName(AfxGetInstanceHandle(),FileName,sizeof(FileName)) == 0) {
+	if (GetModuleFileName(GetInstance(), FileName,sizeof(FileName)) == 0) {
 		return;
 	}
 	ExtractDirName(FileName,HomeDir);
@@ -157,9 +170,7 @@
 		}
 	}
 }
-}
 
-extern "C" {
 BOOL GetFileName(HWND HWin)
 {
 	char FNFilter[31];
@@ -206,9 +217,7 @@
 		return TRUE;
 	}
 }
-}
 
-extern "C" {
 void SetDlgPos(int x, int y)
 {
 	DlgPosX = x;
@@ -217,9 +226,7 @@
 		StatDlg->Update(NULL,NULL,DlgPosX,DlgPosY);
 	}
 }
-}
 
-extern "C" {
 void OpenInpDlg(PCHAR Buff, PCHAR Text, PCHAR Caption,
                 PCHAR Default, BOOL Paswd)
 {
@@ -226,25 +233,19 @@
 	CInpDlg InpDlg(Buff,Text,Caption,Default,Paswd,DlgPosX,DlgPosY);
 	InpDlg.DoModal();
 }
-}
 
-extern "C" {
 int OpenErrDlg(PCHAR Msg, PCHAR Line, int lineno, int start, int end, PCHAR FileName)
 {
 	CErrDlg ErrDlg(Msg,Line,DlgPosX,DlgPosY, lineno, start, end, FileName);
 	return ErrDlg.DoModal();
 }
-}
 
-extern "C" {
 int OpenMsgDlg(PCHAR Text, PCHAR Caption, BOOL YesNo)
 {
 	CMsgDlg MsgDlg(Text,Caption,YesNo,DlgPosX,DlgPosY);
 	return MsgDlg.DoModal();
 }
-}
 
-extern "C" {
 void OpenStatDlg(PCHAR Text, PCHAR Caption)
 {
 	if (StatDlg==NULL) {
@@ -256,20 +257,18 @@
 		StatDlg->Update(Text,Caption,32767,0);
 	}
 }
-}
 
-extern "C" {
 void CloseStatDlg()
 {
 	if (StatDlg==NULL) {
 		return;
 	}
+	assert(_CrtCheckMemory());
 	StatDlg->DestroyWindow();
+	assert(_CrtCheckMemory());
 	StatDlg = NULL;
 }
-}
 
-extern "C" {
 void BringupStatDlg()
 {
 	if (StatDlg==NULL) {
@@ -277,18 +276,22 @@
 	}
 	StatDlg->Bringup();
 }
-}
 
-extern "C" {
+/**
+ * @retval 0\x88ȏ\xE3	\x91I\x91\xF0\x8D\x80\x96\xDA
+ * @retval -1		cancel\x83{\x83^\x83\x93
+ * @retval -2		close\x83{\x83^\x83\x93
+ */
 int OpenListDlg(PCHAR Text, PCHAR Caption, CHAR **Lists, int Selected)
 {
-	int ret = -1;
+	HINSTANCE hInst = GetInstance();
+	HWND hWnd = GetHWND();
 
 	CListDlg ListDlg(Text, Caption, Lists, Selected, DlgPosX, DlgPosY);
-	if (ListDlg.DoModal() == IDOK) {
-		ret = ListDlg.m_SelectItem;
+	INT_PTR r = ListDlg.DoModal();
+	if (r == IDOK) {
+		return ListDlg.m_SelectItem;
 	}
-	return (ret);
+	return r == IDCANCEL ? -1 : -2;
 }
-}
 

Modified: trunk/teraterm/ttpmacro/ttmlib.c
===================================================================
--- trunk/teraterm/ttpmacro/ttmlib.c	2019-04-01 12:45:02 UTC (rev 7536)
+++ trunk/teraterm/ttpmacro/ttmlib.c	2019-04-01 12:45:26 UTC (rev 7537)
@@ -35,6 +35,8 @@
 #include <direct.h>
 #include <Shlobj.h>
 
+#include "ttmlib.h"
+
 static char CurrentDir[MAXPATHLEN];
 
 typedef struct {
@@ -62,7 +64,7 @@
 	{ NULL,                -1}
 };
 
-void CalcTextExtent(HDC DC, PCHAR Text, LPSIZE s)
+void CalcTextExtent(HDC DC, const char *Text, LPSIZE s)
 {
   int W, H, i, i0;
   char Temp[512];
@@ -216,3 +218,29 @@
 		AttachThreadInput(thisThreadId, fgThreadId, FALSE);
 	}
 }
+
+/**
+ * \x95\xB6\x8E\x9A\x82\xF0\x95`\x89悵\x82\xBD\x8E\x9E\x82ǂ\xF1\x82Ȕ͈͂ɂȂ邩\x8Cv\x8EZ\x82\xB7\x82\xE9
+ */
+void CalcTextExtent2(HWND hWnd, HFONT Font, const TCHAR *Text, LPSIZE textSize)
+{
+	HDC TmpDC = GetDC(hWnd);
+	HFONT prevFont = NULL;
+	if (Font) {
+		prevFont = (HFONT)SelectObject(TmpDC, Font);
+	}
+	CalcTextExtent(TmpDC, (PCHAR)Text, textSize);
+	if (Font && prevFont != NULL) {
+		SelectObject(TmpDC, prevFont);
+	}
+	ReleaseDC(hWnd, TmpDC);
+}
+
+int MessageBoxHaltScript(HWND hWnd)//, const char *UILanguageFile)
+{
+	char uimsg[MAX_UIMSG];
+	char uimsg2[MAX_UIMSG];
+	get_lang_msg("MSG_MACRO_CONF", uimsg, sizeof(uimsg), "MACRO: confirmation", UILanguageFile);
+	get_lang_msg("MSG_MACRO_HALT_SCRIPT", uimsg2, sizeof(uimsg2), "Are you sure that you want to halt this macro script?", UILanguageFile);
+	return MessageBox(hWnd, uimsg2, uimsg, MB_YESNO | MB_ICONWARNING | MB_DEFBUTTON2);
+}

Modified: trunk/teraterm/ttpmacro/ttmlib.h
===================================================================
--- trunk/teraterm/ttpmacro/ttmlib.h	2019-04-01 12:45:02 UTC (rev 7536)
+++ trunk/teraterm/ttpmacro/ttmlib.h	2019-04-01 12:45:26 UTC (rev 7537)
@@ -35,7 +35,8 @@
 
 extern char UILanguageFile[MAX_PATH];
 
-void CalcTextExtent(HDC DC, PCHAR Text, LPSIZE s);
+void CalcTextExtent(HDC DC, const char *Text, LPSIZE s);
+void CalcTextExtent2(HWND hWnd, HFONT Font, const TCHAR *Text, LPSIZE textSize);	// TODO name
 void TTMGetDir(PCHAR Dir, int destlen);
 void TTMSetDir(PCHAR Dir);
 int GetAbsPath(PCHAR FName, int destlen);
@@ -42,6 +43,7 @@
 int GetSpecialFolder(PCHAR dest, int dest_len, PCHAR type);
 int GetMonitorLeftmost(int PosX, int PosY);
 void BringupWindow(HWND hWnd);
+int MessageBoxHaltScript(HWND hWnd);
 
 #ifdef __cplusplus
 }

Modified: trunk/teraterm/ttpmacro/ttmmain.cpp
===================================================================
--- trunk/teraterm/ttpmacro/ttmmain.cpp	2019-04-01 12:45:02 UTC (rev 7536)
+++ trunk/teraterm/ttpmacro/ttmmain.cpp	2019-04-01 12:45:26 UTC (rev 7537)
@@ -29,7 +29,9 @@
 
 /* TTMACRO.EXE, main */
 
-#include "stdafx.h"
+#include <windows.h>
+#include <commctrl.h>
+#include <stdio.h>
 #include "teraterm.h"
 #include "ttm_res.h"
 #include "ttmdlg.h"
@@ -40,27 +42,60 @@
 #include "ttmmain.h"
 #include "ttmbuff.h"
 #include "ttmlib.h"
+#include "dlglib.h"
 
 #include "ttlib.h"
 
 #include "wait4all.h"
 
-#ifdef _DEBUG
-#define new DEBUG_NEW
-#undef THIS_FILE
-static char THIS_FILE[] = __FILE__;
-#endif
+#include "tmfc.h"
 
+extern HINSTANCE GetInstance();
+
+static void ClientToScreen(HWND hWnd, RECT *rect)
+{
+	POINT pos;
+	pos.x = rect->left;
+	pos.y = rect->top;
+	::ClientToScreen(hWnd, &pos);
+	rect->left = pos.x;
+	rect->top = pos.y;
+
+	pos.x = rect->right;
+	pos.y = rect->bottom;
+	::ClientToScreen(hWnd, &pos);
+	rect->right = pos.x;
+	rect->bottom = pos.y;
+}
+
+static void ScreenToClient(HWND hWnd, RECT *rect)
+{
+	POINT pos;
+	pos.x = rect->left;
+	pos.y = rect->top;
+	::ScreenToClient(hWnd, &pos);
+	rect->left = pos.x;
+	rect->top = pos.y;
+
+	pos.x = rect->right;
+	pos.y = rect->bottom;
+	::ScreenToClient(hWnd, &pos);
+	rect->right = pos.x;
+	rect->bottom = pos.y;
+}
+
 // CCtrlWindow dialog
 CCtrlWindow::CCtrlWindow()
-	: CDialog()
 {
-	m_hIcon = AfxGetApp()->LoadIcon(IDI_TTMACRO);
+	HINSTANCE hInst = GetInstance();
+	m_hIcon = LoadIcon(hInst, MAKEINTRESOURCE(IDI_TTMACRO));
 }
 
 BOOL CCtrlWindow::Create()
 {
-	if (! CDialog::Create(CCtrlWindow::IDD, NULL)) {
+	HINSTANCE hInst = GetInstance();
+	HWND parent = NULL;
+	if (! TTCDialog::Create(hInst, parent, CCtrlWindow::IDD)) {
 		PostQuitMessage(0);
 		return FALSE;
 	}
@@ -105,7 +140,7 @@
 		// \x8DX\x90V\x91Ώۂ̃}\x83N\x83\x8D\x83R\x83}\x83\x93\x83h\x82̏ꍇ\x82̂݁A\x83E\x83B\x83\x93\x83h\x83E\x82ɍX\x90V\x8Ew\x8E\xA6\x82\xF0\x8Fo\x82\xB7\x81B
 		// \x96\x88\x93x WM_PAINT \x82𑗂\xC1\x82Ă\xA2\x82\xE9\x82ƃ}\x83N\x83\x8D\x82̓\xAE\x8D삪\x92x\x82\xAD\x82Ȃ邽\x82߁B(2006.2.24 yutaka)
 		if (IsUpdateMacroCommand()) {
-			Invalidate(TRUE);
+			::InvalidateRect(m_hWnd, NULL, TRUE);
 		}
 		return TRUE;
 	}
@@ -112,7 +147,7 @@
 	else if (TTLStatus==IdTTLWait) {
 		ResultCode = Wait();
 		if (ResultCode>0) {
-			KillTimer(IdTimeOutTimer);
+			::KillTimer(m_hWnd, IdTimeOutTimer);
 			TTLStatus = IdTTLRun;
 			LockVar();
 			SetResult(ResultCode);
@@ -121,7 +156,7 @@
 			return TRUE;
 		}
 		else if (ComReady==0) {
-			SetTimer(IdTimeOutTimer,0, NULL);
+			::SetTimer(m_hWnd, IdTimeOutTimer,0, NULL);
 		}
 	}
 	else if (TTLStatus==IdTTLWaitLn) {
@@ -133,7 +168,7 @@
 			Temp[0] = 0x0a;
 			Temp[1] = 0;
 			if (CmpWait(ResultCode,Temp)==0) { // new-line is received
-				KillTimer(IdTimeOutTimer);
+				::KillTimer(m_hWnd, IdTimeOutTimer);
 				ClearWait();
 				TTLStatus = IdTTLRun;
 				LockVar();
@@ -148,13 +183,13 @@
 			return TRUE;
 		}
 		else if (ComReady==0) {
-			SetTimer(IdTimeOutTimer,0, NULL);
+			::SetTimer(m_hWnd, IdTimeOutTimer,0, NULL);
 		}
 	}
 	else if (TTLStatus==IdTTLWaitNL) {
 		ResultCode = Wait();
 		if (ResultCode>0) {
-			KillTimer(IdTimeOutTimer);
+			::KillTimer(m_hWnd, IdTimeOutTimer);
 			TTLStatus = IdTTLRun;
 			LockVar();
 			SetInputStr(GetRecvLnBuff());
@@ -162,12 +197,12 @@
 			return TRUE;
 		}
 		else if (ComReady==0) {
-			SetTimer(IdTimeOutTimer,0, NULL);
+			::SetTimer(m_hWnd, IdTimeOutTimer,0, NULL);
 		}
 	}
 	else if (TTLStatus==IdTTLWait2) {
 		if (Wait2()) {
-			KillTimer(IdTimeOutTimer);
+			::KillTimer(m_hWnd, IdTimeOutTimer);
 			TTLStatus = IdTTLRun;
 			LockVar();
 			SetInputStr(Wait2Str);
@@ -176,12 +211,12 @@
 			return TRUE;
 		}
 		else if (ComReady==0) {
-			SetTimer(IdTimeOutTimer,0, NULL);
+			::SetTimer(m_hWnd, IdTimeOutTimer,0, NULL);
 		}
 	}
 	else if (TTLStatus==IdTTLWaitN) {
 		if (WaitN()) {
-			KillTimer(IdTimeOutTimer);
+			::KillTimer(m_hWnd, IdTimeOutTimer);
 			TTLStatus = IdTTLRun;
 			LockVar();
 			SetResult(1);
@@ -191,13 +226,13 @@
 			return TRUE;
 		}
 		else if (ComReady==0) {
-			SetTimer(IdTimeOutTimer,0, NULL);
+			::SetTimer(m_hWnd, IdTimeOutTimer,0, NULL);
 		}
 	}
 	else if (TTLStatus==IdTTLWait4all) {
 		ResultCode = Wait4all();
 		if (ResultCode>0) {
-			KillTimer(IdTimeOutTimer);
+			::KillTimer(m_hWnd, IdTimeOutTimer);
 			TTLStatus = IdTTLRun;
 			LockVar();
 			SetResult(ResultCode);
@@ -206,7 +241,7 @@
 			return TRUE;
 		}
 		else if (ComReady==0) {
-			SetTimer(IdTimeOutTimer,0, NULL);
+			::SetTimer(m_hWnd, IdTimeOutTimer,0, NULL);
 		}
 	}
 
@@ -213,6 +248,7 @@
 	return FALSE;
 }
 
+#if 0
 BEGIN_MESSAGE_MAP(CCtrlWindow, CDialog)
 	//{{AFX_MSG_MAP(CCtrlWindow)
 	ON_WM_CLOSE()
@@ -231,11 +267,16 @@
 	ON_MESSAGE(WM_USER_DDEEND,OnDdeEnd)
 	//}}AFX_MSG_MAP
 END_MESSAGE_MAP()
+#endif
 
 // CCtrlWindow message handler
 
 BOOL CCtrlWindow::OnInitDialog()
 {
+	static const DlgTextInfo TextInfos[] = {
+		{ IDC_CTRLPAUSESTART, "BTN_PAUSE" },
+		{ IDC_CTRLEND, "BTN_END" },
+	};
 	HDC TmpDC;
 	int CRTWidth, CRTHeight;
 	RECT Rect;
@@ -242,35 +283,20 @@
 	char Temp[MAX_PATH + 8]; // MAX_PATH + "MACRO - "(8)
 	BOOL IOption, VOption;
 	int CmdShow;
-	char uimsg[MAX_UIMSG], uimsg2[MAX_UIMSG];
-	LOGFONT logfont;
-	HFONT font;
 	int fuLoad = LR_DEFAULTCOLOR;
 	RECT rc_dlg, rc_filename, rc_lineno;
 	LONG dlg_len, len;
+	HINSTANCE hInst = GetInstance();
 
-	CDialog::OnInitDialog();
+	SetDlgTexts(m_hWnd, TextInfos, _countof(TextInfos), UILanguageFile);
 
-	font = (HFONT)SendMessage(WM_GETFONT, 0, 0);
-	GetObject(font, sizeof(LOGFONT), &logfont);
-	if (get_lang_font("DLG_SYSTEM_FONT", m_hWnd, &logfont, &DlgFont, UILanguageFile)) {
-		SendDlgItemMessage(IDC_CTRLPAUSESTART, WM_SETFONT, (WPARAM)DlgFont, MAKELPARAM(TRUE,0));
-		SendDlgItemMessage(IDC_CTRLEND, WM_SETFONT, (WPARAM)DlgFont, MAKELPARAM(TRUE,0));
-	}
-
-	GetDlgItemText(IDC_CTRLPAUSESTART, uimsg2, sizeof(uimsg2));
-	get_lang_msg("BTN_PAUSE", uimsg, sizeof(uimsg), uimsg2, UILanguageFile);
-	SetDlgItemText(IDC_CTRLPAUSESTART, uimsg);
-	GetDlgItemText(IDC_CTRLEND, uimsg2, sizeof(uimsg2));
-	get_lang_msg("BTN_END", uimsg, sizeof(uimsg), uimsg2, UILanguageFile);
-	SetDlgItemText(IDC_CTRLEND, uimsg);
-
 	Pause = FALSE;
 
+	// \x83Z\x83\x93\x83^\x81[\x82Ɏ\x9D\x82\xC1\x82Ă\xA2\x82\xAD
 	TmpDC = ::GetDC(GetSafeHwnd());
-	CRTWidth = GetDeviceCaps(TmpDC,HORZRES);
-	CRTHeight = GetDeviceCaps(TmpDC,VERTRES);
-	GetWindowRect(&Rect);
+	CRTWidth = ::GetDeviceCaps(TmpDC,HORZRES);
+	CRTHeight = ::GetDeviceCaps(TmpDC,VERTRES);
+	::GetWindowRect(m_hWnd, &Rect);
 	::ReleaseDC(GetSafeHwnd(), TmpDC);
 	::SetWindowPos(GetSafeHwnd(),HWND_TOP,
 	               (CRTWidth-Rect.right+Rect.left) / 2,
@@ -281,11 +307,11 @@
 		fuLoad = LR_VGACOLOR;
 	}
 	::PostMessage(GetSafeHwnd(),WM_SETICON,ICON_SMALL,
-	              (LPARAM)LoadImage(AfxGetInstanceHandle(),
+	              (LPARAM)LoadImage(hInst,
 	                                MAKEINTRESOURCE(IDI_TTMACRO),
 	                                IMAGE_ICON,16,16,fuLoad));
 	::PostMessage(GetSafeHwnd(),WM_SETICON,ICON_BIG,
-	              (LPARAM)LoadImage(AfxGetInstanceHandle(),
+	              (LPARAM)LoadImage(hInst,
 	                                MAKEINTRESOURCE(IDI_TTMACRO),
 	                                IMAGE_ICON,0,0,fuLoad));
 
@@ -325,20 +351,20 @@
 	 * (2015.1.2 yutaka)
 	 */
 	// \x8C\xBB\x8D݃T\x83C\x83Y\x82\xA9\x82\xE7\x95K\x97v\x82Ȓl\x82\xF0\x8Cv\x8EZ
-	GetClientRect(&rc_dlg);
-	ClientToScreen(&rc_dlg);
+	::GetClientRect(m_hWnd, &rc_dlg);
+	ClientToScreen(m_hWnd, &rc_dlg);
 	dlg_len = rc_dlg.right - rc_dlg.left;
 
-	GetDlgItem(IDC_FILENAME)->GetWindowRect(&rc_filename);
+	::GetWindowRect(GetDlgItem(IDC_FILENAME), &rc_filename);
 	len = rc_filename.right - rc_filename.left;
 	m_filename_ratio = len*100 / dlg_len;
 
-	GetDlgItem(IDC_LINENO)->GetWindowRect(&rc_lineno);
+	::GetWindowRect(GetDlgItem(IDC_LINENO), &rc_lineno);
 	len = rc_lineno.right - rc_lineno.left;
 	m_lineno_ratio = len * 100 / dlg_len;
 
 	// \x83\x8A\x83T\x83C\x83Y\x83A\x83C\x83R\x83\x93\x82\xF0\x89E\x89\xBA\x82ɕ\\x8E\xA6\x82\xB3\x82\xB9\x82\xBD\x82\xA2\x82̂ŁA\x83X\x83e\x81[\x83^\x83X\x83o\x81[\x82\xF0\x95t\x82\xAF\x82\xE9\x81B
-	m_hStatus = CreateStatusWindow(
+	m_hStatus = ::CreateStatusWindow(
 		WS_CHILD | WS_VISIBLE |
 		CCS_BOTTOM | SBARS_SIZEGRIP, NULL, GetSafeHwnd(), 1);
 
@@ -356,10 +382,13 @@
 	return TRUE;
 }
 
-void CCtrlWindow::OnCancel( )
+BOOL CCtrlWindow::OnCancel( )
 {
+#if 1
 	::DestroyWindow(m_hStatus);
 	DestroyWindow();
+#endif
+	return TRUE;	// cancel(ESC\x89\x9F\x89\xBA)\x82𖳎\x8B
 }
 
 BOOL CCtrlWindow::OnCommand(WPARAM wParam, LPARAM lParam)
@@ -367,30 +396,31 @@
 	char uimsg[MAX_UIMSG];
 
 	switch (LOWORD(wParam)) {
-		case IDC_CTRLPAUSESTART:
-			if (Pause) {
-				get_lang_msg("BTN_PAUSE", uimsg, sizeof(uimsg),  "Pau&se", UILanguageFile);
-				SetDlgItemText(IDC_CTRLPAUSESTART, uimsg);
-			}
-			else {
-				get_lang_msg("BTN_START", uimsg, sizeof(uimsg),  "&Start", UILanguageFile);
-				SetDlgItemText(IDC_CTRLPAUSESTART, uimsg);
-			}
-			Pause = ! Pause;
-			return TRUE;
-		case IDC_CTRLEND:
-			TTLStatus = IdTTLEnd;
-			return TRUE;
-		default:
-			return (CDialog::OnCommand(wParam,lParam));
+	case IDC_CTRLPAUSESTART:
+		if (Pause) {
+			get_lang_msg("BTN_PAUSE", uimsg, sizeof(uimsg),  "Pau&se", UILanguageFile);
+			SetDlgItemText(IDC_CTRLPAUSESTART, uimsg);
+		}
+		else {
+			get_lang_msg("BTN_START", uimsg, sizeof(uimsg),  "&Start", UILanguageFile);
+			SetDlgItemText(IDC_CTRLPAUSESTART, uimsg);
+		}
+		Pause = ! Pause;
+		return TRUE;
+	case IDC_CTRLEND:
+		TTLStatus = IdTTLEnd;
+		PostQuitMessage(0);
+		return TRUE;
+	default:
+		return FALSE;
 	}
 }
 
-void CCtrlWindow::OnClose()
+BOOL CCtrlWindow::OnClose()
 {
 	EndTTL();
 	EndDDE();
-	CDialog::OnClose();
+	return TRUE;
 }
 
 void CCtrlWindow::OnDestroy()
@@ -399,17 +429,17 @@
 
 	EndTTL();
 	EndDDE();
-	CDialog::OnDestroy();
+//	CDialog::OnDestroy();
 }
 
 // for icon drawing in Win NT 3.5
-BOOL CCtrlWindow::OnEraseBkgnd(CDC* pDC)
+BOOL CCtrlWindow::OnEraseBkgnd(HDC DC)
 {
-	if (IsIconic()) {
+	if (::IsIconic(m_hWnd)) {
 		return TRUE;
 	}
 	else {
-		return CDialog::OnEraseBkgnd(pDC);
+		return FALSE;
 	}
 }
 
@@ -416,10 +446,12 @@
 // for icon drawing in Win NT 3.5
 void CCtrlWindow::OnPaint()
 {
-	int OldMapMode;
-	CPaintDC dc(this);
+	PAINTSTRUCT ps;
+	HDC dc;
 	char buf[128];
 
+	dc = BeginPaint(&ps);
+
 	// line number (2005.7.18 yutaka)
 	// added line buffer (2005.7.22 yutaka)
 	// added MACRO filename (2013.9.8 yutaka)
@@ -428,13 +460,15 @@
 	_snprintf_s(buf, sizeof(buf), _TRUNCATE, ":%d:%s", GetLineNo(), GetLineBuffer());
 	SetDlgItemText(IDC_LINENO, buf);
 
-	OldMapMode = dc.GetMapMode();
-	dc.SetMapMode(MM_TEXT);
+	if (::IsIconic(m_hWnd)) {
+		int OldMapMode = GetMapMode(dc);
+		SetMapMode(dc, MM_TEXT);
+		SendMessage(WM_ICONERASEBKGND,(UINT)dc, 0);	// TODO
+		DrawIcon(dc, 0, 0, m_hIcon);
+		SetMapMode(dc, OldMapMode);
+	}
 
-	if (!IsIconic()) return;
-	SendMessage(WM_ICONERASEBKGND,(UINT)(dc.m_hDC));
-	dc.DrawIcon(0, 0, m_hIcon);
-	dc.SetMapMode(OldMapMode);
+	EndPaint(&ps);
 }
 
 // \x83}\x83N\x83\x8D\x83E\x83B\x83\x93\x83h\x83E\x82\xF0\x83\x8A\x83T\x83C\x83Y\x89”\\x82Ƃ\xB7\x82邽\x82߂ɁAOnSize\x83n\x83\x93\x83h\x83\x89\x82\xF0override\x82\xB7\x82\xE9\x81B
@@ -445,16 +479,17 @@
 	LONG new_w, new_h, new_x, new_y;
 	LONG len;
 
-	GetClientRect(&rc_dlg);
-	ClientToScreen(&rc_dlg);
+	::GetClientRect(m_hWnd, &rc_dlg);
+	ClientToScreen(m_hWnd, &rc_dlg);
 	len = rc_dlg.right - rc_dlg.left;
 
 	// TTL\x83t\x83@\x83C\x83\x8B\x96\xBC\x82̍Ĕz\x92u
-	GetDlgItem(IDC_FILENAME)->GetWindowRect(&rc_filename);
-	ScreenToClient(&rc_filename);
+	HWND hWnd = GetDlgItem(IDC_FILENAME);
+	::GetWindowRect(hWnd, &rc_filename);
+	ScreenToClient(m_hWnd, &rc_filename);
 	new_w = (len * m_filename_ratio) / 100;
 	new_h = rc_filename.bottom - rc_filename.top;
-	GetDlgItem(IDC_FILENAME)->SetWindowPos(&CWnd::wndBottom,
+	::SetWindowPos(hWnd, HWND_BOTTOM,
 		0, 0, new_w, new_h,
 		SWP_NOMOVE | SWP_NOZORDER
 	);
@@ -461,18 +496,19 @@
 	new_x = rc_filename.left + new_w;
 
 	// \x8Ds\x94ԍ\x86\x82̍Ĕz\x92u
-	GetDlgItem(IDC_LINENO)->GetWindowRect(&rc_lineno);
-	ScreenToClient(&rc_lineno);
+	hWnd = GetDlgItem(IDC_LINENO);
+	::GetWindowRect(hWnd, &rc_lineno);
+	ScreenToClient(m_hWnd, &rc_lineno);
 	new_w = (len * m_lineno_ratio) / 100;
 	new_h = rc_lineno.bottom - rc_lineno.top;
 	new_y = rc_lineno.top;
-	GetDlgItem(IDC_LINENO)->SetWindowPos(&CWnd::wndBottom,
+	::SetWindowPos(hWnd, HWND_BOTTOM,
 		new_x, new_y, new_w, new_h,
 		SWP_NOZORDER
 		);
 
 	// status bar
-	::SendMessage(m_hStatus, WM_SIZE, cx, cy);
+	::SendMessage(m_hStatus, WM_SIZE, nType, (cy<<16)|cx );
 }
 
 // \x83}\x83N\x83\x8D\x83E\x83B\x83\x93\x83h\x83E\x82\xF0\x83\x8A\x83T\x83C\x83Y\x89”\\x82Ƃ\xB7\x82邽\x82߂ɁAOnGetMinMaxInfo\x83n\x83\x93\x83h\x83\x89\x82\xF0override\x82\xB7\x82\xE9\x81B
@@ -497,16 +533,18 @@
 	return m_hIcon;
 }
 
+#if 0
 void CCtrlWindow::OnSysColorChange()
 {
 	CDialog::OnSysColorChange();
 }
+#endif
 
-void CCtrlWindow::OnTimer(UINT nIDEvent)
+void CCtrlWindow::OnTimer(UINT_PTR nIDEvent)
 {
 	BOOL TimeOut;
 
-	KillTimer(nIDEvent);
+	::KillTimer(m_hWnd, nIDEvent);
 	if (nIDEvent!=IdTimeOutTimer) {
 		return;
 	}
@@ -576,15 +614,17 @@
 		return;
 	}
 
-	SetTimer(IdTimeOutTimer, TIMEOUT_TIMER_MS, NULL);
+	::SetTimer(m_hWnd, IdTimeOutTimer, TIMEOUT_TIMER_MS, NULL);
 }
 
-void CCtrlWindow::PostNcDestroy()
+BOOL CCtrlWindow::PostNcDestroy()
 {
 	delete this;
 	PostQuitMessage(0);
+	return TRUE;
 }
 
+#if 0
 BOOL CCtrlWindow::PreTranslateMessage(MSG* pMsg)
 {
 	if ((pMsg->message==WM_KEYDOWN) && (pMsg->wParam==VK_ESCAPE)) { // ignore ESC key
@@ -592,8 +632,9 @@
 	}
 	return CDialog::PreTranslateMessage(pMsg);
 }
+#endif
 
-LONG CCtrlWindow::OnDdeCmndEnd(UINT wParam, LONG lParam)
+LRESULT CCtrlWindow::OnDdeCmndEnd(WPARAM wParam, LPARAM lParam)
 {
 	if (TTLStatus == IdTTLWaitCmndResult) {
 		LockVar();
@@ -608,7 +649,7 @@
 	return 0;
 }
 
-LONG CCtrlWindow::OnDdeComReady(UINT wParam, LONG lParam)
+LRESULT CCtrlWindow::OnDdeComReady(WPARAM wParam, LPARAM lParam)
 {
 	ComReady = wParam;
 	if ((TTLStatus == IdTTLWait) ||
@@ -617,7 +658,7 @@
 	    (TTLStatus == IdTTLWait2) ||
 	    (TTLStatus == IdTTLWaitN)) {
 		if (ComReady==0) {
-			SetTimer(IdTimeOutTimer,0, NULL);
+			::SetTimer(m_hWnd, IdTimeOutTimer,0, NULL);
 		}
 	}
 	else if (TTLStatus==IdTTLSleep) {
@@ -644,7 +685,7 @@
 	return 0;
 }
 
-LONG CCtrlWindow::OnDdeReady(UINT wParam, LONG lParam)
+LRESULT CCtrlWindow::OnDdeReady(WPARAM wParam, LPARAM lParam)
 {
 	if (TTLStatus != IdTTLInitDDE) {
 		return 0;
@@ -662,7 +703,7 @@
 	return 0;
 }
 
-LONG CCtrlWindow::OnDdeEnd(UINT wParam, LONG lParam)
+LRESULT CCtrlWindow::OnDdeEnd(WPARAM wParam, LPARAM lParam)
 {
 	EndDDE();
 	if ((TTLStatus == IdTTLWaitCmndEnd) ||
@@ -674,7 +715,7 @@
 	         (TTLStatus == IdTTLWaitNL) ||
 	         (TTLStatus == IdTTLWait2) ||
 	         (TTLStatus == IdTTLWaitN)) {
-		SetTimer(IdTimeOutTimer,0, NULL);
+		::SetTimer(m_hWnd, IdTimeOutTimer,0, NULL);
 	}
 	else if (TTLStatus==IdTTLSleep) {
 		LockVar();
@@ -691,7 +732,7 @@
 	return 0;
 }
 
-LONG CCtrlWindow::OnMacroBringup(UINT wParam, LONG lParam)
+LRESULT CCtrlWindow::OnMacroBringup(WPARAM wParam, LPARAM lParam)
 {
 	DWORD pid;
 	DWORD thisThreadId;
@@ -701,13 +742,64 @@
 	fgThreadId = GetWindowThreadProcessId(::GetForegroundWindow(), &pid);
 
 	if (thisThreadId == fgThreadId) {
-		SetForegroundWindow();
-		BringWindowToTop();
+		::SetForegroundWindow(m_hWnd);
+		::BringWindowToTop(m_hWnd);
 	} else {
 		AttachThreadInput(thisThreadId, fgThreadId, TRUE);
-		SetForegroundWindow();
-		BringWindowToTop();
+		::SetForegroundWindow(m_hWnd);
+		::BringWindowToTop(m_hWnd);
 		AttachThreadInput(thisThreadId, fgThreadId, FALSE);
 	}
 	return 0;
 }
+
+LRESULT CCtrlWindow::DlgProc(UINT msg, WPARAM wp, LPARAM lp)
+{
+	switch(msg)
+	{
+#if 0	// tmfc\x82ŏ\x88\x97\x9D\x82\xB3\x82\xEA\x82\xE9
+	case WM_CLOSE:
+		OnClose();
+		break;
+#endif
+	case WM_DESTROY:
+		OnDestroy();
+		PostQuitMessage(0);
+		break;
+	case WM_ERASEBKGND:
+		OnEraseBkgnd((HDC)wp);
+		break;
+	case WM_PAINT:
+		OnPaint();
+		break;
+	case WM_SIZE:
+		OnSize(wp, LOWORD(lp), HIWORD(lp));
+		break;
+	case WM_GETMINMAXINFO:
+		OnGetMinMaxInfo((MINMAXINFO *)lp);
+		break;
+#if 0
+	case WM_QUERYDRAGICON:
+	case WM_SYSCOLORCHANGE:
+#endif
+	case WM_TIMER:
+		OnTimer(wp);
+		break;
+	case WM_USER_DDECMNDEND:
+		OnDdeCmndEnd(wp, lp);
+		break;
+	case WM_USER_DDECOMREADY:
+		OnDdeComReady(wp, lp);
+		break;
+	case WM_USER_DDEREADY:
+		OnDdeReady(wp, lp);
+		break;
+	case WM_USER_MACROBRINGUP:
+		OnMacroBringup(wp, lp);
+		break;
+	case WM_USER_DDEEND:
+		OnDdeEnd(wp, lp);
+		break;
+	}
+	return FALSE;
+}

Modified: trunk/teraterm/ttpmacro/ttmmain.h
===================================================================
--- trunk/teraterm/ttpmacro/ttmmain.h	2019-04-01 12:45:02 UTC (rev 7536)
+++ trunk/teraterm/ttpmacro/ttmmain.h	2019-04-01 12:45:26 UTC (rev 7537)
@@ -29,12 +29,13 @@
 
 /* TTMACRO.EXE, main window */
 
+#include "tmfc.h"
 #include "ttmmsg.h"
 #include "tttypes.h"
 /////////////////////////////////////////////////////////////////////////////
 // CCtrlWindow dialog
 
-class CCtrlWindow : public CDialog
+class CCtrlWindow : public TTCDialog
 {
 public:
 	BOOL Pause;
@@ -49,11 +50,13 @@
 
 	//{{AFX_VIRTUAL(CCtrlWindow)
 	protected:
-	virtual void OnCancel( );
+	virtual BOOL OnCancel( );
 	virtual BOOL OnCommand(WPARAM wParam, LPARAM lParam);
-	virtual void PostNcDestroy();
-	virtual BOOL PreTranslateMessage(MSG* pMsg);
+	virtual BOOL PostNcDestroy();
+	virtual BOOL OnInitDialog();
+	//	virtual BOOL PreTranslateMessage(MSG* pMsg);		// TODO
 	//}}AFX_VIRTUAL
+	virtual LRESULT DlgProc(UINT msg, WPARAM wp, LPARAM lp);
 
 protected:
 	HICON m_hIcon;
@@ -64,23 +67,22 @@
 	HWND m_hStatus;
 
 	//{{AFX_MSG(CCtrlWindow)
-	virtual BOOL OnInitDialog();
-	afx_msg void OnClose();
+#define afx_msg
+	afx_msg BOOL OnClose();
 	afx_msg void OnDestroy();
-	afx_msg BOOL OnEraseBkgnd(CDC* pDC);
+	afx_msg BOOL OnEraseBkgnd(HDC DC);
 	afx_msg void OnPaint();
 	afx_msg void OnSize(UINT nType, int cx, int cy);
 	afx_msg void OnGetMinMaxInfo(MINMAXINFO* lpMMI);
 	afx_msg HCURSOR OnQueryDragIcon();
 	afx_msg void OnSysColorChange();
-	afx_msg void OnTimer(UINT nIDEvent);
-	afx_msg LONG OnDdeCmndEnd(UINT wParam, LONG lParam);
-	afx_msg LONG OnDdeComReady(UINT wParam, LONG lParam);
-	afx_msg LONG OnDdeReady(UINT wParam, LONG lParam);
-	afx_msg LONG OnDdeEnd(UINT wParam, LONG lParam);
-	afx_msg LONG OnMacroBringup(UINT wParam, LONG lParam);
+	afx_msg void OnTimer(UINT_PTR nIDEvent);
+	afx_msg LRESULT OnDdeCmndEnd(WPARAM wParam, LPARAM lParam);
+	afx_msg LRESULT OnDdeComReady(WPARAM wParam, LPARAM lParam);
+	afx_msg LRESULT OnDdeReady(WPARAM wParam, LPARAM lParam);
+	afx_msg LRESULT OnDdeEnd(WPARAM wParam, LPARAM lParam);
+	afx_msg LRESULT OnMacroBringup(WPARAM wParam, LPARAM lParam);
 	//}}AFX_MSG
-	DECLARE_MESSAGE_MAP()
+//	DECLARE_MESSAGE_MAP()
 };
 
-typedef CCtrlWindow *PCtrlWindow;

Modified: trunk/teraterm/ttpmacro/ttpmacro.rc
===================================================================
--- trunk/teraterm/ttpmacro/ttpmacro.rc	2019-04-01 12:45:02 UTC (rev 7536)
+++ trunk/teraterm/ttpmacro/ttpmacro.rc	2019-04-01 12:45:26 UTC (rev 7537)
@@ -1,6 +1,8 @@
 // Microsoft Visual C++ generated resource script.
 //
+#include <windows.h>
 #include "ttm_res.h"
+#define IDC_STATIC 0
 
 #define APSTUDIO_READONLY_SYMBOLS
 /////////////////////////////////////////////////////////////////////////////
@@ -7,7 +9,7 @@
 //
 // Generated from the TEXTINCLUDE 2 resource.
 //
-#include "afxres.h"
+//#include "afxres.h"
 
 /////////////////////////////////////////////////////////////////////////////
 #undef APSTUDIO_READONLY_SYMBOLS
@@ -91,7 +93,7 @@
 BEGIN
     DEFPUSHBUTTON   "OK",IDOK,0,31,35,12
     LTEXT           "",IDC_MSGTEXT,0,8,65,9,SS_NOPREFIX
-    PUSHBUTTON      "No",IDCLOSE,45,31,35,12,NOT WS_VISIBLE
+    PUSHBUTTON      "No",IDCANCEL,45,31,35,12,NOT WS_VISIBLE
 END
 
 IDD_STATDLG DIALOGEX 0, 0, 52, 25
@@ -108,8 +110,8 @@
 BEGIN
     DEFPUSHBUTTON   "OK",IDOK,129,7,50,14
     PUSHBUTTON      "Cancel",IDCANCEL,129,24,50,14
-    LISTBOX         IDC_LISTBOX,7,7,104,49,LBS_SORT | LBS_USETABSTOPS | LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_HSCROLL | WS_TABSTOP
-    LTEXT           "Static",IDC_STATIC,7,63,172,15
+    LISTBOX         IDC_LISTBOX,7,7,104,49,LBS_USETABSTOPS | LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_HSCROLL | WS_TABSTOP
+    LTEXT           "Static",IDC_LISTTEXT,7,63,172,15
 END
 
 

Added: trunk/tests/gui_commands_test.ttl
===================================================================
--- trunk/tests/gui_commands_test.ttl	                        (rev 0)
+++ trunk/tests/gui_commands_test.ttl	2019-04-01 12:45:26 UTC (rev 7537)
@@ -0,0 +1,259 @@
+;;;
+;;; test gui commands
+;;;
+;
+call test_messagebox
+call test_errordialogbox
+call test_yesnobox
+call test_inputbox
+call test_passwordbox
+call test_statusbox
+call test_macrodialogbox
+call test_listbox
+messagebox "finish all tests" "test"
+end
+
+;;;;;;;;;;;;;;;;
+;;; messagebox
+:test_messagebox
+s = "messagebox test\nthis is basic test\n3 lines"
+strspecial s
+messagebox s "test messagebox"
+messagebox "finish messagebox test" "test messagebox"
+return
+
+;;;;;;;;;;;;;;;;
+;;; error dialog
+;;; - Dependence
+;;;		messagebox
+:test_errordialogbox
+messagebox "Please push `continue` button in next window" "test errordialogbox"
+this_line_is_error_push_continue
+messagebox "finish error dialog test" "test error dialog"
+return
+
+;;;;;;;;;;;;;;;;
+;;; yesnobox
+;;; - Dependence
+;;;		messagebox
+:test_yesnobox
+yes = 0
+no = 0
+while ((yes == 0) or (no == 0))
+	yesnobox "push yes or no" "test yesnobox"
+	if result == 1 yes = yes + 1
+	if result == 0 no = no + 1
+	sprintf "yes=%d no=%d" yes no
+	messagebox inputstr "test yesnobox"
+endwhile
+sprintf "finish yesnobox test\nyes=%d no=%d" yes no
+s = inputstr
+strspecial s
+messagebox s "test yesnobox"
+return
+
+;;;;;;;;;;;;;;;;
+;;; inputbox
+;;; - Dependence
+;;;		messagebox
+:test_inputbox
+s = "default string"
+match = 0
+while match == 0
+	inputbox "input `ok` to finish" "test inputbox" s
+	s = inputstr
+	sprintf "input string is `%s`" s
+	messagebox inputstr "test inputbox"
+	strmatch s "^ok$"
+	match = result
+endwhile
+messagebox "finish inputbox test" "test inputbox"
+return
+
+;;;;;;;;;;;;;;;;
+;;; passwordbox
+;;; - Dependence
+;;;		messagebox
+:test_passwordbox
+match = 0
+while match == 0
+	passwordbox "input `password` to finish" "test passwordbox"
+	s = inputstr
+	sprintf "input string is `%s`" s
+	messagebox inputstr "test inputbox"
+	strmatch s "^password$"
+	match = result
+endwhile
+messagebox "finish passwordbox test" "test passwordbox"
+return
+
+;;;;;;;;;;;;;;;;
+;;; statusbox
+;;; setdlgpos
+;;; closesbox
+;;; - Dependence
+;;;		messagebox
+:test_statusbox
+call test_statusbox_centerwindow
+call test_statusbox_setdlgpos
+return
+
+; 表示されていない→表示する 時 センタリングされる
+; 表示されている時 width=変化しない height=変化する(フィット) pos=変化しない
+:test_statusbox_centerwindow
+pause_time = 3
+statusbox "statusbox message" "test statusbox"
+pause pause_time
+sprintf2 s "1 line1\n2 line2 \n3 line3\n4 long long long long long line"
+strspecial s
+statusbox s "test statusbox"
+pause pause_time
+closesbox
+statusbox s "test statusbox"
+pause pause_time
+statusbox "statusbox message" "test statusbox"
+pause pause_time
+closesbox
+statusbox "statusbox message" "test statusbox"
+pause pause_time
+closesbox
+messagebox "finish statusbox centerwindow test" "test statusbox"
+return
+
+:test_statusbox_setdlgpos
+pause_time = 1
+last_val = 3
+statusbox "statusbox message" "test statusbox"
+pause pause_time
+for i 1 last_val
+	x = i*10
+	y = i*10
+	setdlgpos x y
+	sprintf2 s "setdlgpos\ni=%d/%d\n(%d,%d)" i last_val x y
+	strspecial s
+	statusbox s "test statusbox/setdlgpos"
+	pause pause_time
+next
+closesbox
+s = "Please overwrap other window\nwait 5 sec\nbringupbox test"
+strspecial s
+setdlgpos 0 0
+statusbox s "test statusbox"
+pause 5
+bringupbox
+statusbox "bringupbox" "test statusbox"
+pause 5
+closesbox
+setdlgpos -10000 0	  ; go center
+messagebox "finish statusbox setdlgpos test" "test statusbox"
+return
+
+;;;;;;;;;;;;;;;;
+;;; macrodialog box
+;;; show
+;;; - Dependence
+;;;		messagebox
+:test_macrodialogbox
+call test_macrodialogbox_show
+call test_macrodialogbox_move_resize
+messagebox "finish macro dialogbox test" "test macro dialogbox"
+return
+
+:test_macrodialogbox_show
+N = 5
+intdim show_flag_list N
+show_flag_list[0] = 1
+show_flag_list[1] = -1
+show_flag_list[2] = 1
+show_flag_list[3] = 0
+show_flag_list[4] = 1
+for i 0 N-1
+	show_flag = show_flag_list[i]
+	show show_flag
+	if show_flag < 0 then
+	   s = "macro dialog box was hidden\ncheck task bar"
+	elseif show_flag == 0 then
+	   s = "macro dialog box was minimize\ncheck task bar"
+	elseif show_flag > 0 then
+	   s = "macro dialog box was shown\nmove this messagebox and check macro dialog box"
+	endif
+	sprintf "show %d\n%s" show_flag s
+	s = inputstr
+	strspecial s
+	messagebox s "test macrodialog/show"
+next
+return
+
+:test_macrodialogbox_move_resize
+w = 15
+sprintf "move and resize test\nwait %d sec" w
+s = inputstr
+strspecial s
+messagebox s "test macro dialog"
+pause w
+messagebox "finish move and resize test" "test macro dialog/move and resize"
+return
+
+;;;;;;;;;;;;;;;;
+;;; listbox
+;;; - Dependence
+;;;		messagebox
+:test_listbox
+N = 7
+intdim done N
+strdim strs N
+strdim srcs N
+for i 0 N-1
+	done[i] = 0
+next
+srcs[0] = "No man should understand where his dreams come from, Data. (Soong to Data, Birthright pt. 1)"
+srcs[1] = "The Advocate will refrain from making her opponent disappear. (Data to Ardra, Devil's Due)"
+srcs[2] = "He's comparing the Enterprise to a cruise ship? (Picard, The Neutral Zone)"
+srcs[3] = "What's the first rule of acquisition?"
+srcs[4] = "Once you have their money, you never give it back."
+srcs[5] = "Don't thank me, I already regret it. (Odo)"
+srcs[6] = "How long can two people talk about nothing? (Deanna, Starship Mine) "
+done_all = 0
+done_cancel = 0
+prev = 0
+while ((done_all == 0) or (done_cancel == 0))
+	for i 0 N-1
+		if done[i] == 0 then
+			s = ""
+		else
+			s = "[selected]"
+		endif
+		sprintf2 s "%s %s" s srcs[i]
+		strs[i] = s
+	next
+	if done_all == 0 then
+		msg = "select one from list and `ok`"
+		if done_cancel == 0 then
+			strconcat msg " or `cancel`"
+		endif
+	else
+		msg = "push `cancel`"
+	endif
+	listbox msg "test listbox" strs prev
+	if result < 0 then
+		done_cancel = 1
+		continue
+	endif
+	prev = result
+	if done[result] == 0 then
+		done[result] = 1
+	else
+		done[result] = 0
+	endif
+	done_all = 1
+	for i 0 N-1
+		if done[i] == 0 then
+			done_all = 0
+			break
+		endif
+	next
+endwhile
+messagebox "finish listbox test" "test listbox"
+return
+
+

Added: trunk/tests/gui_commands_test_utf8.ttl
===================================================================
--- trunk/tests/gui_commands_test_utf8.ttl	                        (rev 0)
+++ trunk/tests/gui_commands_test_utf8.ttl	2019-04-01 12:45:26 UTC (rev 7537)
@@ -0,0 +1,286 @@
+;;;
+;;; test gui commands
+;;;
+;
+call test_messagebox
+call test_errordialogbox
+call test_yesnobox
+call test_inputbox
+call test_passwordbox
+call test_statusbox
+call test_macrodialogbox
+call test_listbox
+call test_filenamebox
+call test_dirnamebox
+messagebox "finish all tests" "test"
+end
+
+;;;;;;;;;;;;;;;;
+;;; messagebox
+:test_messagebox
+s = "メッセージボックス\nthis is basic test\n3 행"
+strspecial s
+messagebox s "メッセージボックス"
+messagebox "finish messagebox test" "test messagebox"
+return
+
+;;;;;;;;;;;;;;;;
+;;; error dialog
+;;; - Dependence
+;;;		messagebox
+:test_errordialogbox
+messagebox "Please push `continue` button in next window" "test errordialogbox"
+this_line_is_error_push_continue
+messagebox "finish error dialog test" "test error dialog"
+return
+
+;;;;;;;;;;;;;;;;
+;;; yesnobox
+;;; - Dependence
+;;;		messagebox
+:test_yesnobox
+yes = 0
+no = 0
+while ((yes == 0) or (no == 0))
+	yesnobox "push 是的(yes) or 没有(no)" "test yesnobox"
+	if result == 1 yes = yes + 1
+	if result == 0 no = no + 1
+	sprintf "yes=%d no=%d" yes no
+	messagebox inputstr "test yesnobox"
+endwhile
+sprintf "finish yesnobox test\nyes=%d no=%d" yes no
+s = inputstr
+strspecial s
+messagebox s "test yesnobox"
+return
+
+;;;;;;;;;;;;;;;;
+;;; inputbox
+;;; - Dependence
+;;;		messagebox
+:test_inputbox
+s = "default string"
+match = 0
+while match == 0
+	inputbox "入力 `ok` to finish" "test inputbox" s
+	s = inputstr
+	sprintf "入力文字列 は `%s`" s
+	messagebox inputstr "test inputbox"
+	strmatch s "^ok$"
+	match = result
+endwhile
+messagebox "finish inputbox test" "test inputbox"
+return
+
+;;;;;;;;;;;;;;;;
+;;; passwordbox
+;;; - Dependence
+;;;		messagebox
+:test_passwordbox
+match = 0
+while match == 0
+	passwordbox "`password` と入力すると終了" "test passwordbox"
+	s = inputstr
+	sprintf "入力文字列 は `%s`" s
+	messagebox inputstr "test inputbox"
+	strmatch s "^password$"
+	match = result
+endwhile
+messagebox "finish passwordbox test" "test passwordbox"
+return
+
+;;;;;;;;;;;;;;;;
+;;; statusbox
+;;; setdlgpos
+;;; closesbox
+;;; - Dependence
+;;;		messagebox
+:test_statusbox
+call test_statusbox_centerwindow
+;call test_statusbox_setdlgpos
+return
+
+; 表示されていない→表示する 時 センタリングされる
+; 表示されている時 width=変化しない height=変化する(フィット) pos=変化しない
+:test_statusbox_centerwindow
+pause_time = 3
+statusbox "statusbox message" "test statusbox"
+pause pause_time
+sprintf2 s "1 line1\n2 line2 \n3 line3\n4 long long long long long line"
+strspecial s
+statusbox s "test statusbox"
+pause pause_time
+closesbox
+statusbox s "test statusbox"
+pause pause_time
+statusbox "statusbox message" "test statusbox"
+pause pause_time
+closesbox
+statusbox "statusbox message" "test statusbox"
+pause pause_time
+closesbox
+messagebox "finish statusbox centerwindow test" "test statusbox"
+return
+
+:test_statusbox_setdlgpos
+pause_time = 1
+last_val = 3
+statusbox "statusbox message" "test statusbox"
+pause pause_time
+for i 1 last_val
+	x = i*10
+	y = i*10
+	setdlgpos x y
+	sprintf2 s "setdlgpos\ni=%d/%d\n(%d,%d)" i last_val x y
+	strspecial s
+	statusbox s "test statusbox/setdlgpos"
+	pause pause_time
+next
+closesbox
+s = "Please overwrap other window\nwait 5 sec\nbringupbox test"
+strspecial s
+setdlgpos 0 0
+statusbox s "test statusbox"
+pause 5
+bringupbox
+statusbox "bringupbox" "test statusbox"
+pause 5
+closesbox
+setdlgpos -10000 0	  ; go center
+messagebox "finish statusbox setdlgpos test" "test statusbox"
+return
+
+;;;;;;;;;;;;;;;;
+;;; macrodialog box
+;;; show
+;;; - Dependence
+;;;		messagebox
+:test_macrodialogbox
+call test_macrodialogbox_show
+call test_macrodialogbox_move_resize
+messagebox "finish macro dialogbox test" "test macro dialogbox"
+return
+
+:test_macrodialogbox_show
+N = 5
+intdim show_flag_list N
+show_flag_list[0] = 1
+show_flag_list[1] = -1
+show_flag_list[2] = 1
+show_flag_list[3] = 0
+show_flag_list[4] = 1
+for i 0 N-1
+	show_flag = show_flag_list[i]
+	show show_flag
+	if show_flag < 0 then
+	   s = "macro dialog box was hidden\ncheck task bar"
+	elseif show_flag == 0 then
+	   s = "macro dialog box was minimize\ncheck task bar"
+	elseif show_flag > 0 then
+	   s = "macro dialog box was shown\nmove this messagebox and check macro dialog box"
+	endif
+	sprintf "show %d\n%s" show_flag s
+	s = inputstr
+	strspecial s
+	messagebox s "test macrodialog/show"
+next
+return
+
+:test_macrodialogbox_move_resize
+w = 15
+sprintf "move and resize test\nwait %d sec" w
+s = inputstr
+strspecial s
+messagebox s "test macro dialog"
+pause w
+messagebox "finish move and resize test" "test macro dialog/move and resize"
+return
+
+;;;;;;;;;;;;;;;;
+;;; listbox
+;;; - Dependence
+;;;		messagebox
+:test_listbox
+N = 7
+intdim done N
+strdim strs N
+strdim srcs N
+for i 0 N-1
+	done[i] = 0
+next
+srcs[0] = "本気の失敗には価値がある"
+srcs[1] = "俺の敵は だいたい俺です"
+srcs[2] = "ちょっとだけ無理なことに挑戦してこーぜ"
+srcs[3] = "リーダーというのはやはり安心と興奮を同時にくれる"
+srcs[4] = "”止まる”も”進む”もコントロールするのはお前だ"
+srcs[5] = "どっちが楽しいかで決めなさい。"
+srcs[6] = "悩むなら、なってから悩みなさい"
+done_all = 0
+done_cancel = 0
+prev = 0
+while ((done_all == 0) or (done_cancel == 0))
+	for i 0 N-1
+		if done[i] == 0 then
+			s = ""
+		else
+			s = "[selected]"
+		endif
+		sprintf2 s "%s %s" s srcs[i]
+		strs[i] = s
+	next
+	if done_all == 0 then
+		msg = "select one from list and `ok`"
+		if done_cancel == 0 then
+			strconcat msg " or `cancel`"
+		endif
+	else
+		msg = "push `cancel`"
+	endif
+	listbox msg "test listbox" strs prev
+	if result < 0 then
+		done_cancel = 1
+		continue
+	endif
+	prev = result
+	if done[result] == 0 then
+		done[result] = 1
+	else
+		done[result] = 0
+	endif
+	done_all = 1
+	for i 0 N-1
+		if done[i] == 0 then
+			done_all = 0
+			break
+		endif
+	next
+endwhile
+messagebox "finish listbox test" "test listbox"
+return
+
+;;;;;;;;;;;;;;;;
+;;; filenamebox
+;;; - Dependence
+;;;		messagebox
+:test_filenamebox
+filenamebox "ファイルを選んでください(load)" 0 "c:\"
+sprintf2 s "result %d inputstr %s" result inputstr
+messagebox s "test fienamebox"
+filenamebox "ファイルを選んでください(save)" 1 "c:\windows"
+sprintf2 s "result %d inputstr %s" result inputstr
+messagebox s "test fienamebox"
+messagebox "finish filenaebox test" "test filenamebox"
+return
+
+;;;;;;;;;;;;;;;;
+;;; dirnamebox
+;;; - Dependence
+;;;		messagebox
+:test_dirnamebox
+dirnamebox "whereディレクトリ" "c:\"
+sprintf2 s "result %d inputstr %s" result inputstr
+messagebox s "test fienamebox"
+messagebox "finish dirnamebox test" "test dirnambox"
+return
+
+


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