[Ttssh2-commit] [7527] tekwinでMFCを使用しないようにした

scmno****@osdn***** scmno****@osdn*****
2019年 3月 29日 (金) 01:38:41 JST


Revision: 7527
          http://sourceforge.jp/projects/ttssh2/scm/svn/commits/7527
Author:   zmatsuo
Date:     2019-03-29 01:38:41 +0900 (Fri, 29 Mar 2019)
Log Message:
-----------
tekwinでMFCを使用しないようにした

Modified Paths:
--------------
    trunk/teraterm/common/ttlib.h
    trunk/teraterm/teraterm/tekwin.cpp
    trunk/teraterm/teraterm/tekwin.h
    trunk/teraterm/teraterm/teraprn.cpp
    trunk/teraterm/teraterm/vtwin.cpp

-------------- next part --------------
Modified: trunk/teraterm/common/ttlib.h
===================================================================
--- trunk/teraterm/common/ttlib.h	2019-03-28 16:38:29 UTC (rev 7526)
+++ trunk/teraterm/common/ttlib.h	2019-03-28 16:38:41 UTC (rev 7527)
@@ -113,6 +113,8 @@
 #define CheckFlag(var, flag)	(((var) & (flag)) != 0)
 
 void SetDlgTexts(HWND hDlgWnd, const DlgTextInfo *infos, int infoCount, const char *UILanguageFile);
+void SetDlgMenuTexts(HMENU hMenu, const DlgTextInfo *infos, int infoCount, const char *UILanguageFile);
+
 #if defined(_UNICODE)
 #define	get_lang_msgT(p1, p2, p3, p4, p5) get_lang_msgW(p1, p2, p3, p4, p5)
 #define	get_OPENFILENAME_SIZE() get_OPENFILENAME_SIZEW()

Modified: trunk/teraterm/teraterm/tekwin.cpp
===================================================================
--- trunk/teraterm/teraterm/tekwin.cpp	2019-03-28 16:38:29 UTC (rev 7526)
+++ trunk/teraterm/teraterm/tekwin.cpp	2019-03-28 16:38:41 UTC (rev 7527)
@@ -1,6 +1,6 @@
 /*
  * Copyright (C) 1994-1998 T. Teranishi
- * (C) 2006-2017 TeraTerm Project
+ * (C) 2006-2019 TeraTerm Project
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -28,7 +28,7 @@
  */
 
 /* TERATERM.EXE, TEK window */
-#include "stdafx.h"
+#include <windowsx.h>
 #include "teraterm.h"
 #include "tttypes.h"
 #include "tektypes.h"
@@ -43,9 +43,15 @@
 #include "tt_res.h"
 #include "tekwin.h"
 #include "ttlib.h"
+#include <htmlhelp.h>
+#include "dlglib.h"
+#include <tchar.h>
 
-#define TEKClassName "TEKWin32"
+#define CWnd	TTCWnd
+#define CFrameWnd	TTCFrameWnd
 
+#define TEKClassName _T("TEKWin32")
+
 #ifdef _DEBUG
 #define new DEBUG_NEW
 #undef THIS_FILE
@@ -52,6 +58,11 @@
 static char THIS_FILE[] = __FILE__;
 #endif
 
+static HINSTANCE AfxGetInstanceHandle()
+{
+	return hInst;
+}
+
 /////////////////////////////////////////////////////////////////////////////
 // CTEKWindow
 
@@ -76,7 +87,7 @@
 	}
 
 	wc.style = CS_HREDRAW | CS_VREDRAW;
-	wc.lpfnWndProc = AfxWndProc;
+	wc.lpfnWndProc = (WNDPROC)ProcStub;
 	wc.cbClsExtra = 0;
 	wc.cbWndExtra = 0;
 	wc.hInstance = AfxGetInstanceHandle();
@@ -97,7 +108,7 @@
 		rect.right = rect.left + 640; //temporary width
 		rect.bottom = rect.top + 400; //temporary height
 	}
-	Create(TEKClassName, "Tera Term", Style, rect, GetDesktopWindow(), NULL);
+	Create(hInst, TEKClassName, _T("Tera Term"), Style, rect, ::GetDesktopWindow(), NULL);
 //--------------------------------------------------------
 	HTEKWin = GetSafeHwnd();
 	if (HTEKWin == NULL) {
@@ -151,6 +162,33 @@
 
 void CTEKWindow::InitMenu(HMENU *Menu)
 {
+	static const DlgTextInfo MenuTextInfo[] = {
+		{ 0, "TEKMENU_FILE" },
+		{ 1, "TEKMENU_EDIT" },
+		{ 2, "TEKMENU_SETUP" },
+		{ ID_TEKVTWIN, "TEKMENU_VTWIN"},
+		{ 4, "TEKMENU_HELP"},
+	};
+	static const DlgTextInfo FileMenuTextInfo[] = {
+		{ ID_TEKFILE_PRINT, "TEKMENU_FILE_PRINT" },
+		{ ID_TEKFILE_EXIT, "TEKMENU_FILE_EXIT" },
+	};
+	static const DlgTextInfo EditMenuTextInfo[] = {
+		{ ID_TEKEDIT_COPY, "TEKMENU_EDIT_COPY" },
+		{ ID_TEKEDIT_COPYSCREEN, "TEKMENU_EDIT_COPYSCREEN" },
+		{ ID_TEKEDIT_PASTE, "TEKMENU_EDIT_PASTE" },
+		{ ID_TEKEDIT_PASTECR, "TEKMENU_EDIT_PASTECR" },
+		{ ID_TEKEDIT_CLEARSCREEN, "TEKMENU_EDIT_CLSCREEN" },
+	};
+	static const DlgTextInfo SetupMenuTextInfo[] = {
+		{ ID_TEKSETUP_WINDOW, "TEKMENU_SETUP_WINDOW" },
+		{ ID_TEKSETUP_FONT, "TEKMENU_SETUP_FONT" },
+	};
+	static const DlgTextInfo HelpMenuTextInfo[] = {
+		{ ID_TEKHELP_INDEX, "TEKMENU_HELP_INDEX" },
+		{ ID_TEKHELP_ABOUT, "TEKMENU_HELP_ABOUT" },
+	};
+
 	*Menu = ::LoadMenu(AfxGetInstanceHandle(),
 	                   MAKEINTRESOURCE(IDR_TEKMENU));
 	EditMenu = GetSubMenu(MainMenu,1);
@@ -157,66 +195,19 @@
 	FileMenu = GetSubMenu(MainMenu,0);
 	SetupMenu = GetSubMenu(MainMenu,2);
 	HelpMenu = GetSubMenu(MainMenu,4);
-	char uimsg[MAX_UIMSG];
 
-	GetMenuString(*Menu, 0, uimsg, sizeof(uimsg), MF_BYPOSITION);
-	get_lang_msg("TEKMENU_FILE", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
-	ModifyMenu(*Menu, 0, MF_BYPOSITION, 0, ts.UIMsg);
-	GetMenuString(FileMenu, ID_TEKFILE_PRINT, uimsg, sizeof(uimsg), MF_BYCOMMAND);
-	get_lang_msg("TEKMENU_FILE_PRINT", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
-	ModifyMenu(FileMenu, ID_TEKFILE_PRINT, MF_BYCOMMAND, ID_TEKFILE_PRINT, ts.UIMsg);
-	GetMenuString(FileMenu, ID_TEKFILE_EXIT, uimsg, sizeof(uimsg), MF_BYCOMMAND);
-	get_lang_msg("TEKMENU_FILE_EXIT", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
-	ModifyMenu(FileMenu, ID_TEKFILE_EXIT, MF_BYCOMMAND, ID_TEKFILE_EXIT, ts.UIMsg);
+	SetDlgMenuTexts(*Menu, MenuTextInfo, _countof(MenuTextInfo), ts.UILanguageFile);
+	SetDlgMenuTexts(FileMenu, FileMenuTextInfo, _countof(FileMenuTextInfo), ts.UILanguageFile);
+	SetDlgMenuTexts(EditMenu, EditMenuTextInfo, _countof(EditMenuTextInfo), ts.UILanguageFile);
+	SetDlgMenuTexts(SetupMenu, SetupMenuTextInfo, _countof(SetupMenuTextInfo), ts.UILanguageFile);
+	SetDlgMenuTexts(HelpMenu, HelpMenuTextInfo, _countof(HelpMenuTextInfo), ts.UILanguageFile);
 
-	GetMenuString(*Menu, 1, uimsg, sizeof(uimsg), MF_BYPOSITION);
-	get_lang_msg("TEKMENU_EDIT", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
-	ModifyMenu(*Menu, 1, MF_BYPOSITION, 1, ts.UIMsg);
-	GetMenuString(EditMenu, ID_TEKEDIT_COPY, uimsg, sizeof(uimsg), MF_BYCOMMAND);
-	get_lang_msg("TEKMENU_EDIT_COPY", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
-	ModifyMenu(EditMenu, ID_TEKEDIT_COPY, MF_BYCOMMAND, ID_TEKEDIT_COPY, ts.UIMsg);
-	GetMenuString(EditMenu, ID_TEKEDIT_COPYSCREEN, uimsg, sizeof(uimsg), MF_BYCOMMAND);
-	get_lang_msg("TEKMENU_EDIT_COPYSCREEN", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
-	ModifyMenu(EditMenu, ID_TEKEDIT_COPYSCREEN, MF_BYCOMMAND, ID_TEKEDIT_COPYSCREEN, ts.UIMsg);
-	GetMenuString(EditMenu, ID_TEKEDIT_PASTE, uimsg, sizeof(uimsg), MF_BYCOMMAND);
-	get_lang_msg("TEKMENU_EDIT_PASTE", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
-	ModifyMenu(EditMenu, ID_TEKEDIT_PASTE, MF_BYCOMMAND, ID_TEKEDIT_PASTE, ts.UIMsg);
-	GetMenuString(EditMenu, ID_TEKEDIT_PASTECR, uimsg, sizeof(uimsg), MF_BYCOMMAND);
-	get_lang_msg("TEKMENU_EDIT_PASTECR", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
-	ModifyMenu(EditMenu, ID_TEKEDIT_PASTECR, MF_BYCOMMAND, ID_TEKEDIT_PASTECR, ts.UIMsg);
-	GetMenuString(EditMenu, ID_TEKEDIT_CLEARSCREEN, uimsg, sizeof(uimsg), MF_BYCOMMAND);
-	get_lang_msg("TEKMENU_EDIT_CLSCREEN", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
-	ModifyMenu(EditMenu, ID_TEKEDIT_CLEARSCREEN, MF_BYCOMMAND, ID_TEKEDIT_CLEARSCREEN, ts.UIMsg);
-
-	GetMenuString(*Menu, 2, uimsg, sizeof(uimsg), MF_BYPOSITION);
-	get_lang_msg("TEKMENU_SETUP", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
-	ModifyMenu(*Menu, 2, MF_BYPOSITION, 2, ts.UIMsg);
-	GetMenuString(SetupMenu, ID_TEKSETUP_WINDOW, uimsg, sizeof(uimsg), MF_BYCOMMAND);
-	get_lang_msg("TEKMENU_SETUP_WINDOW", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
-	ModifyMenu(SetupMenu, ID_TEKSETUP_WINDOW, MF_BYCOMMAND, ID_TEKSETUP_WINDOW, ts.UIMsg);
-	GetMenuString(SetupMenu, ID_TEKSETUP_FONT, uimsg, sizeof(uimsg), MF_BYCOMMAND);
-	get_lang_msg("TEKMENU_SETUP_FONT", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
-	ModifyMenu(SetupMenu, ID_TEKSETUP_FONT, MF_BYCOMMAND, ID_TEKSETUP_FONT, ts.UIMsg);
-
-	GetMenuString(*Menu, ID_TEKVTWIN, uimsg, sizeof(uimsg), MF_BYCOMMAND);
-	get_lang_msg("TEKMENU_VTWIN", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
-	ModifyMenu(*Menu, ID_TEKVTWIN, MF_BYCOMMAND, ID_TEKVTWIN, ts.UIMsg);
-
-	GetMenuString(*Menu, 4, uimsg, sizeof(uimsg), MF_BYPOSITION);
-	get_lang_msg("TEKMENU_HELP", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
-	ModifyMenu(*Menu, 4, MF_BYPOSITION, 4, ts.UIMsg);
-	GetMenuString(HelpMenu, ID_TEKHELP_INDEX, uimsg, sizeof(uimsg), MF_BYCOMMAND);
-	get_lang_msg("TEKMENU_HELP_INDEX", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
-	ModifyMenu(HelpMenu, ID_TEKHELP_INDEX, MF_BYCOMMAND, ID_TEKHELP_INDEX, ts.UIMsg);
-	GetMenuString(HelpMenu, ID_TEKHELP_ABOUT, uimsg, sizeof(uimsg), MF_BYCOMMAND);
-	get_lang_msg("TEKMENU_HELP_ABOUT", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
-	ModifyMenu(HelpMenu, ID_TEKHELP_ABOUT, MF_BYCOMMAND, ID_TEKHELP_ABOUT, ts.UIMsg);
-
 	if ((ts.MenuFlag & MF_SHOWWINMENU) !=0) {
+		TCHAR uimsg[MAX_UIMSG];
 		WinMenu = CreatePopupMenu();
-		get_lang_msg("TEKMENU_WINDOW", ts.UIMsg, sizeof(ts.UIMsg), "&Window", ts.UILanguageFile);
+		get_lang_msgT("TEKMENU_WINDOW", uimsg, _countof(uimsg), _T("&Window"), ts.UILanguageFile);
 		::InsertMenu(*Menu,4,MF_STRING | MF_ENABLED | MF_POPUP | MF_BYPOSITION,
-		             (int)WinMenu, ts.UIMsg);
+		             (UINT_PTR)WinMenu, uimsg);
 	}
 }
 
@@ -246,6 +237,7 @@
 	}
 }
 
+#if 0
 BEGIN_MESSAGE_MAP(CTEKWindow, CFrameWnd)
 	//{{AFX_MSG_MAP(CTEKWindow)
 	ON_WM_ACTIVATE()
@@ -291,6 +283,7 @@
 	ON_WM_TIMER()
 	//}}AFX_MSG_MAP
 END_MESSAGE_MAP()
+#endif
 
 /////////////////////////////////////////////////////////////////////////////
 // CTEKWindow message handler
@@ -326,7 +319,7 @@
 	}
 }
 
-void CTEKWindow::OnActivate(UINT nState, CWnd* pWndOther, BOOL bMinimized)
+void CTEKWindow::OnActivate(UINT nState, HWND pWndOther, BOOL bMinimized)
 {
 	if (nState!=WA_INACTIVE) {
 		tk.Active = TRUE;
@@ -382,9 +375,9 @@
 	lpMMI->ptMaxTrackSize.y = 10000;
 }
 
-void CTEKWindow::OnInitMenuPopup(CMenu* pPopupMenu, UINT nIndex, BOOL bSysMenu)
+void CTEKWindow::OnInitMenuPopup(HMENU hPopupMenu, UINT nIndex, BOOL bSysMenu)
 {
-	InitMenuPopup(pPopupMenu->m_hMenu);
+	InitMenuPopup(hPopupMenu);
 }
 
 void CTEKWindow::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags)
@@ -397,13 +390,13 @@
 	KeyUp(nChar);
 }
 
-void CTEKWindow::OnKillFocus(CWnd* pNewWnd)
+void CTEKWindow::OnKillFocus(HWND hNewWnd)
 {
 	TEKDestroyCaret(&tk,&ts);
-	CFrameWnd::OnKillFocus(pNewWnd);
+	CFrameWnd::OnKillFocus(hNewWnd);
 }
 
-void CTEKWindow::OnLButtonDown(UINT nFlags, CPoint point)
+void CTEKWindow::OnLButtonDown(UINT nFlags, POINTS point)
 {
 	POINT p;
 	HMENU PopupMenu, PopupBase;
@@ -414,6 +407,7 @@
 	// popup menu
 	if (ControlKey() && (MainMenu==NULL))
 	{
+		TCHAR uimsg[MAX_UIMSG];
 		InitMenu(&PopupMenu);
 		InitMenuPopup(EditMenu);
 		if (WinMenu!=NULL) {
@@ -420,26 +414,26 @@
 			InitMenuPopup(WinMenu);
 		}
 		PopupBase = CreatePopupMenu();
-		get_lang_msg("MENU_CONTROL", ts.UIMsg, sizeof(ts.UIMsg), "&File", ts.UILanguageFile);
+		get_lang_msgT("MENU_CONTROL", uimsg, _countof(uimsg), _T("&File"), ts.UILanguageFile);
 		AppendMenu(PopupBase, MF_STRING | MF_ENABLED | MF_POPUP,
-		           (UINT)GetSubMenu(PopupMenu,0), ts.UIMsg);
-		get_lang_msg("TEKMENU_EDIT", ts.UIMsg, sizeof(ts.UIMsg), "&Edit", ts.UILanguageFile);
+		           (UINT_PTR)GetSubMenu(PopupMenu,0), uimsg);
+		get_lang_msgT("TEKMENU_EDIT", uimsg, _countof(uimsg), _T("&Edit"), ts.UILanguageFile);
 		AppendMenu(PopupBase, MF_STRING | MF_ENABLED | MF_POPUP,
-		           (UINT)EditMenu, ts.UIMsg);
-		get_lang_msg("TEKMENU_SETUP", ts.UIMsg, sizeof(ts.UIMsg), "&Setup", ts.UILanguageFile);
+		           (UINT_PTR)EditMenu, uimsg);
+		get_lang_msgT("TEKMENU_SETUP", uimsg, _countof(uimsg), _T("&Setup"), ts.UILanguageFile);
 		AppendMenu(PopupBase, MF_STRING | MF_ENABLED | MF_POPUP,
-		           (UINT)GetSubMenu(PopupMenu,2), ts.UIMsg);
-		get_lang_msg("TEKMENU_VTWIN", ts.UIMsg, sizeof(ts.UIMsg), "VT-Wind&ow", ts.UILanguageFile);
+		           (UINT_PTR)GetSubMenu(PopupMenu,2), uimsg);
+		get_lang_msgT("TEKMENU_VTWIN", uimsg, _countof(uimsg), _T("VT-Wind&ow"), ts.UILanguageFile);
 		AppendMenu(PopupBase, MF_STRING | MF_ENABLED,
-		           ID_TEKVTWIN, ts.UIMsg);
+		           ID_TEKVTWIN, uimsg);
 		if (WinMenu!=NULL) {
-			get_lang_msg("TEKMENU_WINDOW", ts.UIMsg, sizeof(ts.UIMsg), "&Window", ts.UILanguageFile);
+			get_lang_msgT("TEKMENU_WINDOW", uimsg, _countof(uimsg), _T("&Window"), ts.UILanguageFile);
 			AppendMenu(PopupBase, MF_STRING | MF_ENABLED | MF_POPUP,
-			           (UINT)WinMenu, ts.UIMsg);
+			           (UINT_PTR)WinMenu, uimsg);
 		}
-		get_lang_msg("TEKMENU_HELP", ts.UIMsg, sizeof(ts.UIMsg), "&Help", ts.UILanguageFile);
+		get_lang_msgT("TEKMENU_HELP", uimsg, _countof(uimsg), _T("&Help"), ts.UILanguageFile);
 		AppendMenu(PopupBase, MF_STRING | MF_ENABLED | MF_POPUP,
-		           (UINT)GetSubMenu(PopupMenu,4), ts.UIMsg);
+		           (UINT_PTR)GetSubMenu(PopupMenu,4), uimsg);
 		::ClientToScreen(tk.HWin, &p);
 		TrackPopupMenu(PopupBase,TPM_LEFTALIGN | TPM_LEFTBUTTON,
 		               p.x,p.y,0,tk.HWin,NULL);
@@ -455,17 +449,17 @@
 	TEKWMLButtonDown(&tk,&ts,&cv,p);
 }
 
-void CTEKWindow::OnLButtonUp(UINT nFlags, CPoint point)
+void CTEKWindow::OnLButtonUp(UINT nFlags, POINTS point)
 {
 	TEKWMLButtonUp(&tk,&ts);
 }
 
-void CTEKWindow::OnMButtonUp(UINT nFlags, CPoint point)
+void CTEKWindow::OnMButtonUp(UINT nFlags, POINTS point)
 {
 	//OnRButtonUp(nFlags,point);
 }
 
-int CTEKWindow::OnMouseActivate(CWnd* pDesktopWnd, UINT nHitTest, UINT message)
+int CTEKWindow::OnMouseActivate(HWND pDesktopWnd, UINT nHitTest, UINT message)
 {
 	if ((ts.SelOnActive==0) &&
 	    (nHitTest==HTCLIENT)) { //disable mouse event for text selection
@@ -476,7 +470,7 @@
 	}
 }
 
-void CTEKWindow::OnMouseMove(UINT nFlags, CPoint point)
+void CTEKWindow::OnMouseMove(UINT nFlags, POINTS point)
 {
 	POINT p;
 
@@ -497,11 +491,9 @@
 void CTEKWindow::OnPaint()
 {
 	PAINTSTRUCT ps;
-	CDC *cdc;
 	HDC PaintDC;
 
-	cdc = BeginPaint(&ps);
-	PaintDC = cdc->GetSafeHdc();
+	PaintDC = BeginPaint(&ps);
 
 	TEKPaint(&tk,&ts,PaintDC,&ps);
 
@@ -508,15 +500,15 @@
 	EndPaint(&ps);
 }
 
-void CTEKWindow::OnRButtonUp(UINT nFlags, CPoint point)
+void CTEKWindow::OnRButtonUp(UINT nFlags, POINTS point)
 {
 	CBStartPaste(tk.HWin, FALSE, FALSE);
 }
 
-void CTEKWindow::OnSetFocus(CWnd* pOldWnd)
+void CTEKWindow::OnSetFocus(HWND hOldWnd)
 {
 	TEKChangeCaret(&tk,&ts);
-	CFrameWnd::OnSetFocus(pOldWnd);
+	CFrameWnd::OnSetFocus(hOldWnd);
 }
 
 void CTEKWindow::OnSize(UINT nType, int cx, int cy)
@@ -571,7 +563,7 @@
 	}
 }
 
-void CTEKWindow::OnTimer(UINT nIDEvent)
+void CTEKWindow::OnTimer(UINT_PTR nIDEvent)
 {
 	UINT T;
 
@@ -590,7 +582,7 @@
 	}
 }
 
-LONG CTEKWindow::OnAccelCommand(UINT wParam, LONG lParam)
+LRESULT CTEKWindow::OnAccelCommand(WPARAM wParam, LPARAM lParam)
 {
 	switch (wParam) {
 		case IdPrint:
@@ -632,7 +624,7 @@
 	return 0;
 }
 
-LONG CTEKWindow::OnChangeMenu(UINT wParam, LONG lParam)
+LRESULT CTEKWindow::OnChangeMenu(WPARAM wParam, LPARAM lParam)
 {
 	HMENU SysMenu;
 	BOOL Show, B1, B2;
@@ -661,11 +653,12 @@
 	if ((MainMenu!=NULL) &&
 	    (B1 != B2)) {
 		if (WinMenu==NULL) {
+			TCHAR uimsg[MAX_UIMSG];
 			WinMenu = CreatePopupMenu();
-			get_lang_msg("TEKMENU_WINDOW", ts.UIMsg, sizeof(ts.UIMsg), "&Window", ts.UILanguageFile);
+			get_lang_msgT("TEKMENU_WINDOW", uimsg, _countof(uimsg), _T("&Window"), ts.UILanguageFile);
 			::InsertMenu(MainMenu,4,
 			             MF_STRING | MF_ENABLED | MF_POPUP | MF_BYPOSITION,
-			             (int)WinMenu, ts.UIMsg);
+			             (UINT_PTR)WinMenu, uimsg);
 		}
 		else {
 			RemoveMenu(MainMenu,4,MF_BYPOSITION);
@@ -677,21 +670,22 @@
 
 	::GetSystemMenu(tk.HWin,TRUE);
 	if ((! Show) && ((ts.MenuFlag & MF_NOSHOWMENU)==0)) {
+		TCHAR uimsg[MAX_UIMSG];
 		SysMenu = ::GetSystemMenu(tk.HWin,FALSE);
 		AppendMenu(SysMenu, MF_SEPARATOR, 0, NULL);
-		get_lang_msg("TEKMENU_SHOW_MENUBAR", ts.UIMsg, sizeof(ts.UIMsg), "Show menu &bar", ts.UILanguageFile);
-		AppendMenu(SysMenu, MF_STRING, ID_SHOWMENUBAR, ts.UIMsg);
+		get_lang_msgT("TEKMENU_SHOW_MENUBAR", uimsg, _countof(uimsg), _T("Show menu &bar"), ts.UILanguageFile);
+		AppendMenu(SysMenu, MF_STRING, ID_SHOWMENUBAR, uimsg);
 	}
 	return 0;
 }
 
-LONG CTEKWindow::OnChangeTBar(UINT wParam, LONG lParam)
+LRESULT CTEKWindow::OnChangeTBar(WPARAM wParam, LPARAM lParam)
 {
 	BOOL TBar;
 	DWORD Style;
 	HMENU SysMenu;
 
-	Style = GetWindowLong (HTEKWin, GWL_STYLE);
+	Style = GetWindowLongPtr (GWL_STYLE);
 	TBar = ((Style & WS_SYSMENU)!=0);
 	if (TBar == (ts.HideTitle==0)) {
 		return 0;
@@ -704,7 +698,7 @@
 		Style = Style & ~WS_POPUP | WS_SYSMENU | WS_CAPTION | WS_MINIMIZEBOX;
 	}
 	tk.AdjustSize = TRUE;
-	SetWindowLong (HTEKWin, GWL_STYLE, Style);
+	SetWindowLongPtr (GWL_STYLE, Style);
 	::SetWindowPos (HTEKWin, NULL, 0, 0, 0, 0,
 	                SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_FRAMECHANGED);
 	::ShowWindow (HTEKWin, SW_SHOW);
@@ -711,21 +705,22 @@
 
 	if ((ts.HideTitle==0) && (MainMenu==NULL) &&
 	    ((ts.MenuFlag & MF_NOSHOWMENU) == 0)) {
+		TCHAR uimsg[MAX_UIMSG];
 		SysMenu = ::GetSystemMenu(HTEKWin,FALSE);
 		AppendMenu(SysMenu, MF_SEPARATOR, 0, NULL);
-		get_lang_msg("TEKMENU_SHOW_MENUBAR", ts.UIMsg, sizeof(ts.UIMsg), "Show menu &bar", ts.UILanguageFile);
-		AppendMenu(SysMenu, MF_STRING, ID_SHOWMENUBAR, ts.UIMsg);
+		get_lang_msgT("TEKMENU_SHOW_MENUBAR", uimsg, _countof(uimsg), _T("Show menu &bar"), ts.UILanguageFile);
+		AppendMenu(SysMenu, MF_STRING, ID_SHOWMENUBAR, uimsg);
 	}
 	return 0;
 }
 
-LONG CTEKWindow::OnDlgHelp(UINT wParam, LONG lParam)
+LRESULT CTEKWindow::OnDlgHelp(WPARAM wParam, LPARAM lParam)
 {
 	OpenHelp(HH_HELP_CONTEXT, HelpId, ts.UILanguageFile);
 	return 0;
 }
 
-LONG CTEKWindow::OnGetSerialNo(UINT wParam, LONG lParam)
+LRESULT CTEKWindow::OnGetSerialNo(WPARAM wParam, LPARAM lParam)
 {
 	return (LONG)SerialNo;
 }
@@ -855,3 +850,123 @@
 	(*AboutDialog)(tk.HWin);
 	FreeTTDLG();
 }
+
+LRESULT CTEKWindow::Proc(UINT msg, WPARAM wp, LPARAM lp)
+{
+	LRESULT retval = 0;
+	switch(msg)
+	{
+	case WM_ACTIVATE:
+		OnActivate(wp & 0xFFFF, (HWND)wp, (wp >> 16) & 0xFFFF);
+		break;
+	case WM_CHAR:
+		OnChar(wp, LOWORD(lp), HIWORD(lp));
+		break;
+	case WM_DESTROY:
+		OnDestroy();
+		PostQuitMessage(0);
+		break;
+	case WM_GETMINMAXINFO:
+		OnGetMinMaxInfo((MINMAXINFO *)lp);
+		break;
+	case WM_INITMENUPOPUP:
+		OnInitMenuPopup((HMENU)wp, LOWORD(lp), HIWORD(lp));
+		break;
+	case WM_KEYDOWN:
+		OnKeyDown(wp, LOWORD(lp), HIWORD(lp));
+		break;
+	case WM_KEYUP:
+		OnKeyUp(wp, LOWORD(lp), HIWORD(lp));
+		break;
+	case WM_KILLFOCUS:
+		OnKillFocus((HWND)wp);
+		break;
+	case WM_LBUTTONDOWN:
+		OnLButtonDown(wp, MAKEPOINTS(lp));
+		break;
+	case WM_LBUTTONUP:
+		OnLButtonUp(wp, MAKEPOINTS(lp));
+		break;
+	case WM_MBUTTONUP:
+		OnMButtonUp(wp, MAKEPOINTS(lp));
+		break;
+	case WM_MOUSEACTIVATE:
+		OnMouseActivate((HWND)wp, LOWORD(lp), HIWORD(lp));
+		break;
+	case WM_MOUSEMOVE:
+		OnMouseMove(wp, MAKEPOINTS(lp));
+		break;
+	case WM_MOVE:
+		OnMove(LOWORD(lp), HIWORD(lp));
+		break;
+	case WM_PAINT:
+		OnPaint();
+		break;
+	case WM_RBUTTONUP:
+		OnRButtonUp((UINT)wp, MAKEPOINTS(lp));
+		break;
+	case WM_SETFOCUS:
+		OnSetFocus((HWND)wp);
+		DefWindowProc(msg, wp, lp);
+		break;
+	case WM_SIZE:
+		OnSize(wp, LOWORD(lp), HIWORD(lp));
+		break;
+	case WM_SYSCOMMAND:
+		OnSysCommand(wp, lp);
+		DefWindowProc(msg, wp, lp);
+		break;
+	case WM_SYSKEYDOWN:
+		OnSysKeyDown(wp, LOWORD(lp), HIWORD(lp));
+		break;
+	case WM_SYSKEYUP:
+		OnSysKeyUp(wp, LOWORD(lp), HIWORD(lp));
+		break;
+	case WM_TIMER:
+		OnTimer(wp);
+		break;
+	case WM_USER_ACCELCOMMAND:
+		OnAccelCommand(wp, lp);
+		break;
+	case WM_USER_CHANGEMENU:
+		OnChangeMenu(wp, lp);
+		break;
+	case WM_USER_CHANGETBAR:
+		OnChangeTBar(wp, lp);
+		break;
+	case WM_USER_DLGHELP2:
+		OnDlgHelp(wp, lp);
+		break;
+	case WM_USER_GETSERIALNO:
+		OnGetSerialNo(wp, lp);
+		break;
+	case WM_COMMAND:
+	{
+		const WORD wID = GET_WM_COMMAND_ID(wp, lp);
+		switch (wID) {
+		case ID_TEKFILE_PRINT: OnFilePrint(); break;
+		case ID_TEKFILE_EXIT: OnFileExit(); break;
+		case ID_TEKEDIT_COPY: OnEditCopy(); break;
+		case ID_TEKEDIT_COPYSCREEN: OnEditCopyScreen(); break;
+		case ID_TEKEDIT_PASTE: OnEditPaste(); break;
+		case ID_TEKEDIT_PASTECR: OnEditPasteCR(); break;
+		case ID_TEKEDIT_CLEARSCREEN: OnEditClearScreen(); break;
+		case ID_TEKSETUP_WINDOW: OnSetupWindow(); break;
+		case ID_TEKSETUP_FONT: OnSetupFont(); break;
+		case ID_TEKVTWIN: OnVTWin(); break;
+		case ID_TEKWINDOW_WINDOW: OnWindowWindow(); break;
+		case ID_TEKHELP_INDEX: OnHelpIndex(); break;
+		case ID_TEKHELP_ABOUT: OnHelpAbout(); break;
+		default:
+			OnCommand(wp, lp);
+			break;
+		}
+		break;
+	}
+	default:
+		retval = DefWindowProc(msg, wp, lp);
+		break;
+	}
+				
+	return retval;
+}

Modified: trunk/teraterm/teraterm/tekwin.h
===================================================================
--- trunk/teraterm/teraterm/tekwin.h	2019-03-28 16:38:29 UTC (rev 7526)
+++ trunk/teraterm/teraterm/tekwin.h	2019-03-28 16:38:41 UTC (rev 7527)
@@ -1,6 +1,6 @@
 /*
  * Copyright (C) 1994-1998 T. Teranishi
- * (C) 2006-2017 TeraTerm Project
+ * (C) 2006-2019 TeraTerm Project
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -31,17 +31,13 @@
 
 /////////////////////////////////////////////////////////////////////////////
 // CTEKWindow
-
-class CTEKWindow : public CFrameWnd
+#include "tmfc.h"
+class CTEKWindow : public TTCFrameWnd
 {
 private:
   TTEKVar tk;
-#ifndef NO_I18N
   HMENU MainMenu, EditMenu, WinMenu,
     FileMenu, SetupMenu, HelpMenu;
-#else
-  HMENU MainMenu, EditMenu, WinMenu;
-#endif
 
 public:
 	CTEKWindow();
@@ -61,33 +57,34 @@
 
 protected:
 	//{{AFX_MSG(CTEKWindow)
-	afx_msg void OnActivate(UINT nState, CWnd* pWndOther, BOOL bMinimized);
+#define afx_msg
+	afx_msg void OnActivate(UINT nState, HWND pWndOther, BOOL bMinimized);
 	afx_msg void OnChar(UINT nChar, UINT nRepCnt, UINT nFlags);
 	afx_msg void OnDestroy();
 	afx_msg void OnGetMinMaxInfo(MINMAXINFO *lpMMI);
-	afx_msg void OnInitMenuPopup(CMenu* pPopupMenu, UINT nIndex, BOOL bSysMenu);
+	afx_msg void OnInitMenuPopup(HMENU hPopupMenu, UINT nIndex, BOOL bSysMenu);
 	afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
 	afx_msg void OnKeyUp(UINT nChar, UINT nRepCnt, UINT nFlags);
-	afx_msg void OnKillFocus(CWnd* pNewWnd);
-	afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
-	afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
-	afx_msg void OnMButtonUp(UINT nFlags, CPoint point);
-	afx_msg int OnMouseActivate(CWnd* pDesktopWnd, UINT nHitTest, UINT message);
-	afx_msg void OnMouseMove(UINT nFlags, CPoint point);
+	afx_msg void OnKillFocus(HWND hNewWnd);
+	afx_msg void OnLButtonDown(UINT nFlags, POINTS point);
+	afx_msg void OnLButtonUp(UINT nFlags, POINTS point);
+	afx_msg void OnMButtonUp(UINT nFlags, POINTS point);
+	afx_msg int OnMouseActivate(HWND hDesktopWnd, UINT nHitTest, UINT message);
+	afx_msg void OnMouseMove(UINT nFlags, POINTS point);
 	afx_msg void OnMove(int x, int y);
 	afx_msg void OnPaint();
-	afx_msg void OnRButtonUp(UINT nFlags, CPoint point);
-	afx_msg void OnSetFocus(CWnd* pOldWnd);
+	afx_msg void OnRButtonUp(UINT nFlags, POINTS point);
+	afx_msg void OnSetFocus(HWND hOldWnd);
 	afx_msg void OnSize(UINT nType, int cx, int cy);
 	afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
 	afx_msg void OnSysKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
 	afx_msg void OnSysKeyUp(UINT nChar, UINT nRepCnt, UINT nFlags);
-	afx_msg void OnTimer(UINT nIDEvent);
-	afx_msg LONG OnAccelCommand(UINT wParam, LONG lParam);
-	afx_msg LONG OnChangeMenu(UINT wParam, LONG lParam);
-	afx_msg LONG OnChangeTBar(UINT wParam, LONG lParam);
-	afx_msg LONG OnDlgHelp(UINT wParam, LONG lParam);
-	afx_msg LONG OnGetSerialNo(UINT wParam, LONG lParam);
+	afx_msg void OnTimer(UINT_PTR nIDEvent);
+	afx_msg LRESULT OnAccelCommand(WPARAM wParam, LPARAM lParam);
+	afx_msg LRESULT OnChangeMenu(WPARAM wParam, LPARAM lParam);
+	afx_msg LRESULT OnChangeTBar(WPARAM wParam, LPARAM lParam);
+	afx_msg LRESULT OnDlgHelp(WPARAM wParam, LPARAM lParam);
+	afx_msg LRESULT OnGetSerialNo(WPARAM wParam, LPARAM lParam);
 	afx_msg void OnFilePrint();
 	afx_msg void OnFileExit();
 	afx_msg void OnEditCopy();
@@ -103,5 +100,7 @@
 	afx_msg void OnHelpUsing();
 	afx_msg void OnHelpAbout();
 	//}}AFX_MSG
-	DECLARE_MESSAGE_MAP()
+//	DECLARE_MESSAGE_MAP()
+#undef afx_msg
+	virtual LRESULT Proc(UINT msg, WPARAM wp, LPARAM lp);
 };

Modified: trunk/teraterm/teraterm/teraprn.cpp
===================================================================
--- trunk/teraterm/teraterm/teraprn.cpp	2019-03-28 16:38:29 UTC (rev 7526)
+++ trunk/teraterm/teraterm/teraprn.cpp	2019-03-28 16:38:41 UTC (rev 7527)
@@ -45,16 +45,18 @@
 
 #include "teraprn.h"
 
-#ifdef _DEBUG
+#if 0 //def _DEBUG
 #define new DEBUG_NEW
 #undef THIS_FILE
 static char THIS_FILE[] = __FILE__;
 #endif
 
+//#define CWnd TTCWnd
+
 static PRINTDLG PrnDlg;
 
 static HDC PrintDC;
-static LOGFONT Prnlf;
+static LOGFONTA Prnlf;
 static HFONT PrnFont[AttrFontMask+1];
 static int PrnFW, PrnFH;
 static RECT Margin;
@@ -124,7 +126,7 @@
 
 BOOL PrnStart(LPSTR DocumentName)
 {
-	DOCINFO Doc;
+	DOCINFOA Doc;
 	char DocName[50];
 	CWnd* pParent;
 
@@ -146,13 +148,13 @@
 
 	SetAbortProc(PrintDC,PrnAbortProc);
 
-	Doc.cbSize = sizeof(DOCINFO);
+	Doc.cbSize = sizeof(Doc);
 	strncpy_s(DocName,sizeof(DocName),DocumentName,_TRUNCATE);
 	Doc.lpszDocName = DocName;
 	Doc.lpszOutput = NULL;
 	Doc.lpszDatatype = NULL;
 	Doc.fwType = 0;
-	if (StartDoc(PrintDC, &Doc) > 0) {
+	if (StartDocA(PrintDC, &Doc) > 0) {
 		Printing = TRUE;
 	}
 	else {
@@ -243,7 +245,7 @@
 	                 (int)((float)ts.PrnMargin[3] / 100.0 * (float)PPI.y);
 
 	/* create test font */
-	memset(&Prnlf, 0, sizeof(LOGFONT));
+	memset(&Prnlf, 0, sizeof(Prnlf));
 
 	if (ts.PrnFont[0]==0) {
 		Prnlf.lfHeight = ts.VTFontSize.y;
@@ -266,7 +268,7 @@
 	Prnlf.lfQuality = DEFAULT_QUALITY;
 	Prnlf.lfPitchAndFamily = FIXED_PITCH | FF_DONTCARE;
 
-	PrnFont[0] = CreateFontIndirect(&Prnlf);
+	PrnFont[0] = CreateFontIndirectA(&Prnlf);
 
 	DC = GetDC(HVTWin);
 	SelectObject(DC, PrnFont[0]);
@@ -285,7 +287,7 @@
 	/* Normal Font */
 	Prnlf.lfWeight = FW_NORMAL;
 	Prnlf.lfUnderline = 0;
-	PrnFont[0] = CreateFontIndirect(&Prnlf);
+	PrnFont[0] = CreateFontIndirectA(&Prnlf);
 	SelectObject(PrintDC,PrnFont[0]);
 	GetTextMetrics(PrintDC, &Metrics);
 	PrnFW = Metrics.tmAveCharWidth;
@@ -292,16 +294,16 @@
 	PrnFH = Metrics.tmHeight;
 	/* Under line */
 	Prnlf.lfUnderline = 1;
-	PrnFont[AttrUnder] = CreateFontIndirect(&Prnlf);
+	PrnFont[AttrUnder] = CreateFontIndirectA(&Prnlf);
 
 	if (ts.FontFlag & FF_BOLD) {
 		/* Bold */
 		Prnlf.lfUnderline = 0;
 		Prnlf.lfWeight = FW_BOLD;
-		PrnFont[AttrBold] = CreateFontIndirect(&Prnlf);
+		PrnFont[AttrBold] = CreateFontIndirectA(&Prnlf);
 		/* Bold + Underline */
 		Prnlf.lfUnderline = 1;
-		PrnFont[AttrBold | AttrUnder] = CreateFontIndirect(&Prnlf);
+		PrnFont[AttrBold | AttrUnder] = CreateFontIndirectA(&Prnlf);
 	}
 	else {
 		PrnFont[AttrBold] = PrnFont[AttrDefault];
@@ -315,7 +317,7 @@
 	Prnlf.lfCharSet = SYMBOL_CHARSET;
 
 	strncpy_s(Prnlf.lfFaceName, sizeof(Prnlf.lfFaceName),"Tera Special", _TRUNCATE);
-	PrnFont[AttrSpecial] = CreateFontIndirect(&Prnlf);
+	PrnFont[AttrSpecial] = CreateFontIndirectA(&Prnlf);
 	PrnFont[AttrSpecial | AttrBold] = PrnFont[AttrSpecial];
 	PrnFont[AttrSpecial | AttrUnder] = PrnFont[AttrSpecial];
 	PrnFont[AttrSpecial | AttrBold | AttrUnder] = PrnFont[AttrSpecial];
@@ -416,7 +418,7 @@
 			Ptr2 = Ptr;
 			do {
 				Ptr1 = Ptr2;
-				Ptr2 = CharNext(Ptr1);
+				Ptr2 = CharNextA(Ptr1);
 			} while ((Ptr2!=NULL) && ((Ptr2-Ptr)<=i));
 			i = Ptr1-Ptr;
 			if (i<=0) {
@@ -428,7 +430,7 @@
 		RText.right = PrnX + i*PrnFW;
 		RText.top = PrnY;
 		RText.bottom = PrnY+PrnFH;
-		ExtTextOut(PrintDC,PrnX,PrnY,6,&RText,Ptr,i,&PrnDx[0]);
+		ExtTextOutA(PrintDC,PrnX,PrnY,6,&RText,Ptr,i,&PrnDx[0]);
 		PrnX = RText.right;
 		Count=Count-i;
 		Ptr = Ptr + i;
@@ -474,8 +476,8 @@
 		return;
 	}
 	if (PrnFName[0] == 0) {
-		GetTempPath(sizeof(Temp),Temp);
-		if (GetTempFileName(Temp,"tmp",0,PrnFName)==0) {
+		GetTempPathA(sizeof(Temp),Temp);
+		if (GetTempFileNameA(Temp,"tmp",0,PrnFName)==0) {
 			return;
 		}
 		HPrnFile = _lcreat(PrnFName,0);

Modified: trunk/teraterm/teraterm/vtwin.cpp
===================================================================
--- trunk/teraterm/teraterm/vtwin.cpp	2019-03-28 16:38:29 UTC (rev 7526)
+++ trunk/teraterm/teraterm/vtwin.cpp	2019-03-28 16:38:41 UTC (rev 7527)
@@ -49,7 +49,6 @@
 #include "filesys.h"
 #include "telnet.h"
 #include "tektypes.h"
-#include "tekwin.h"
 #include "ttdde.h"
 #include "ttlib.h"
 #include "helpid.h"
@@ -79,6 +78,7 @@
 #include "winjump.h"
 #include "sizetip.h"
 #include "dnddlg.h"
+#include "tekwin.h"
 #include "compat_win.h"
 
 #include "initguid.h"


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