[Ttssh2-commit] [7214] mfcなし状態

scmno****@osdn***** scmno****@osdn*****
2018年 9月 3日 (月) 19:51:24 JST


Revision: 7214
          http://sourceforge.jp/projects/ttssh2/scm/svn/commits/7214
Author:   zmatsuo
Date:     2018-09-03 19:51:24 +0900 (Mon, 03 Sep 2018)
Log Message:
-----------
mfcなし状態

Modified Paths:
--------------
    branches/cmake/teraterm/teraterm/CMakeLists.txt
    branches/cmake/teraterm/teraterm/tekwin.cpp
    branches/cmake/teraterm/teraterm/tekwin.h
    branches/cmake/teraterm/teraterm/teraprn.cpp
    branches/cmake/teraterm/teraterm/teraterm.cpp
    branches/cmake/teraterm/teraterm/tmfc.cpp
    branches/cmake/teraterm/teraterm/tmfc.h
    branches/cmake/teraterm/teraterm/vtwin.cpp
    branches/cmake/teraterm/teraterm/vtwin.h

Added Paths:
-----------
    branches/cmake/teraterm/teraterm/tekwin_sub.cpp
    branches/cmake/teraterm/teraterm/tekwin_sub.h

-------------- next part --------------
Modified: branches/cmake/teraterm/teraterm/CMakeLists.txt
===================================================================
--- branches/cmake/teraterm/teraterm/CMakeLists.txt	2018-09-03 10:51:20 UTC (rev 7213)
+++ branches/cmake/teraterm/teraterm/CMakeLists.txt	2018-09-03 10:51:24 UTC (rev 7214)
@@ -70,6 +70,8 @@
   teklib.h
   tekwin.cpp
   tekwin.h
+  tekwin_sub.cpp
+  tekwin_sub.h
   telnet.c
   telnet.h
   teraapp.h

Modified: branches/cmake/teraterm/teraterm/tekwin.cpp
===================================================================
--- branches/cmake/teraterm/teraterm/tekwin.cpp	2018-09-03 10:51:20 UTC (rev 7213)
+++ branches/cmake/teraterm/teraterm/tekwin.cpp	2018-09-03 10:51:24 UTC (rev 7214)
@@ -28,7 +28,7 @@
  */
 
 /* TERATERM.EXE, TEK window */
-#include "stdafx.h"
+//#include "stdafx.h"
 #include "teraterm.h"
 #include "tttypes.h"
 #include "tektypes.h"
@@ -43,7 +43,13 @@
 #include "tt_res.h"
 #include "tekwin.h"
 #include "ttlib.h"
+#include "htmlhelp.h"
 
+#define CWnd	TTCWnd
+#define CFrameWnd	TTCFrameWnd
+#define CMenu TTCMenu
+#define CPoint	TTCPoint
+
 #define TEKClassName "TEKWin32"
 
 #ifdef _DEBUG
@@ -52,6 +58,11 @@
 static char THIS_FILE[] = __FILE__;
 #endif
 
+static HINSTANCE AfxGetInstanceHandle()
+{
+	return hInst;
+}
+
 /////////////////////////////////////////////////////////////////////////////
 // CTEKWindow
 
@@ -76,7 +87,8 @@
 	}
 
 	wc.style = CS_HREDRAW | CS_VREDRAW;
-	wc.lpfnWndProc = AfxWndProc;
+//	wc.lpfnWndProc = (WNDPROC)AfxWndProc;
+	wc.lpfnWndProc = (WNDPROC)ProcStub;
 	wc.cbClsExtra = 0;
 	wc.cbWndExtra = 0;
 	wc.hInstance = AfxGetInstanceHandle();
@@ -97,7 +109,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, "Tera Term", Style, rect, ::GetDesktopWindow(), NULL);
 //--------------------------------------------------------
 	HTEKWin = GetSafeHwnd();
 	if (HTEKWin == NULL) {
@@ -246,6 +258,7 @@
 	}
 }
 
+#if 0
 BEGIN_MESSAGE_MAP(CTEKWindow, CFrameWnd)
 	//{{AFX_MSG_MAP(CTEKWindow)
 	ON_WM_ACTIVATE()
@@ -291,6 +304,7 @@
 	ON_WM_TIMER()
 	//}}AFX_MSG_MAP
 END_MESSAGE_MAP()
+#endif
 
 /////////////////////////////////////////////////////////////////////////////
 // CTEKWindow message handler
@@ -497,11 +511,10 @@
 void CTEKWindow::OnPaint()
 {
 	PAINTSTRUCT ps;
-	CDC *cdc;
+//	CDC *cdc;
 	HDC PaintDC;
 
-	cdc = BeginPaint(&ps);
-	PaintDC = cdc->GetSafeHdc();
+	PaintDC = BeginPaint(&ps);
 
 	TEKPaint(&tk,&ts,PaintDC,&ps);
 

Modified: branches/cmake/teraterm/teraterm/tekwin.h
===================================================================
--- branches/cmake/teraterm/teraterm/tekwin.h	2018-09-03 10:51:20 UTC (rev 7213)
+++ branches/cmake/teraterm/teraterm/tekwin.h	2018-09-03 10:51:24 UTC (rev 7214)
@@ -31,8 +31,8 @@
 
 /////////////////////////////////////////////////////////////////////////////
 // CTEKWindow
-
-class CTEKWindow : public CFrameWnd
+#include "tekwin_sub.h"
+class CTEKWindow : public TTCFrameWnd
 {
 private:
   TTEKVar tk;
@@ -61,23 +61,24 @@
 
 protected:
 	//{{AFX_MSG(CTEKWindow)
-	afx_msg void OnActivate(UINT nState, CWnd* pWndOther, BOOL bMinimized);
+#define afx_msg
+	afx_msg void OnActivate(UINT nState, TTCWnd* 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(TTCMenu* pPopupMenu, 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(TTCWnd* pNewWnd);
+	afx_msg void OnLButtonDown(UINT nFlags, TTCPoint point);
+	afx_msg void OnLButtonUp(UINT nFlags, TTCPoint point);
+	afx_msg void OnMButtonUp(UINT nFlags, TTCPoint point);
+	afx_msg int OnMouseActivate(TTCWnd* pDesktopWnd, UINT nHitTest, UINT message);
+	afx_msg void OnMouseMove(UINT nFlags, TTCPoint 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, TTCPoint point);
+	afx_msg void OnSetFocus(TTCWnd* pOldWnd);
 	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);
@@ -103,5 +104,6 @@
 	afx_msg void OnHelpUsing();
 	afx_msg void OnHelpAbout();
 	//}}AFX_MSG
-	DECLARE_MESSAGE_MAP()
+//	DECLARE_MESSAGE_MAP()
+#undef afx_msg
 };

Added: branches/cmake/teraterm/teraterm/tekwin_sub.cpp
===================================================================
--- branches/cmake/teraterm/teraterm/tekwin_sub.cpp	                        (rev 0)
+++ branches/cmake/teraterm/teraterm/tekwin_sub.cpp	2018-09-03 10:51:24 UTC (rev 7214)
@@ -0,0 +1,123 @@
+
+#include "tekwin_sub.h"
+#include "ttlib.h"
+
+const RECT TTCFrameWnd::rectDefault =
+{
+	CW_USEDEFAULT, CW_USEDEFAULT,
+//	2*CW_USEDEFAULT, 2*CW_USEDEFAULT
+	0, 0
+};
+
+TTCFrameWnd::TTCFrameWnd()
+{
+}
+
+TTCFrameWnd::~TTCFrameWnd()
+{
+}
+
+BOOL TTCFrameWnd::Create(
+	HINSTANCE hInstance,
+	LPCTSTR lpszClassName,
+	LPCTSTR lpszWindowName,
+	DWORD dwStyle,
+	const RECT& rect,
+	HWND hParentWnd,
+	LPCTSTR lpszMenuName,
+	DWORD dwExStyle)
+{
+	pseudoPtr = this;
+	DWORD s = WS_OVERLAPPEDWINDOW;
+	HWND hWnd = ::CreateWindowExA(
+		0,
+		lpszClassName,
+		lpszWindowName,
+		dwStyle,
+		rect.left, rect.top,
+		rect.right - rect.left, rect.bottom - rect.top,
+		hParentWnd,
+		NULL,
+		hInstance,
+		NULL);
+	pseudoPtr = NULL;
+	if (hWnd == NULL) {
+		OutputDebugPrintf("CreateWindow %d\n", GetLastError());
+		return FALSE;
+	} else {
+		m_hWnd = hWnd;
+		SetWindowLongPtr(hWnd, GWLP_USERDATA, (LONG_PTR)this);
+		return TRUE;
+	}
+}
+
+TTCFrameWnd *TTCFrameWnd::pseudoPtr;
+
+LRESULT TTCFrameWnd::ProcStub(HWND hWnd, UINT msg, WPARAM wp, LPARAM lp)
+{
+	TTCFrameWnd *self;
+	if (pseudoPtr != NULL) {
+		self = pseudoPtr;
+		self->m_hWnd = hWnd;
+	} else {
+		self = (TTCFrameWnd *)GetWindowLongPtr(hWnd, GWLP_USERDATA);
+	}
+	return self->Proc(msg, wp, lp);
+}
+
+LRESULT TTCFrameWnd::Proc(UINT msg, WPARAM wp, LPARAM lp)
+{
+	return DefWindowProc(msg, wp, lp);
+}
+
+BOOL TTCFrameWnd::OnCommand(WPARAM wParam, LPARAM lParam)
+{
+	return FALSE;
+}
+
+void TTCFrameWnd::OnInitMenuPopup(TTCMenu* pPopupMenu, UINT nIndex, BOOL bSysMenu)
+{}
+
+void TTCFrameWnd::OnKillFocus(TTCWnd* pNewWnd)
+{}
+
+void TTCFrameWnd::OnDestroy()
+{}
+
+void TTCFrameWnd::OnSetFocus(TTCWnd* pOldWnd)
+{}
+
+void TTCFrameWnd::OnSysCommand(UINT nID, LPARAM lParam)
+{}
+
+void TTCFrameWnd::OnSysKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags)
+{}
+
+void TTCFrameWnd::OnSysKeyUp(UINT nChar, UINT nRepCnt, UINT nFlags)
+{}
+
+void TTCFrameWnd::OnClose()
+{}
+
+
+////////////////////////////////////////
+
+void TTCWnd::DestroyWindow()
+{
+	::DestroyWindow(m_hWnd);
+}
+
+HDC TTCWnd::BeginPaint(LPPAINTSTRUCT lpPaint)
+{
+	return ::BeginPaint(m_hWnd, lpPaint);
+}
+
+BOOL TTCWnd::EndPaint(LPPAINTSTRUCT lpPaint)
+{
+	return ::EndPaint(m_hWnd, lpPaint);
+}
+
+LRESULT TTCWnd::DefWindowProc(UINT msg, WPARAM wParam, LPARAM lParam)
+{
+	return ::DefWindowProc(m_hWnd, msg, wParam, lParam);
+}

Added: branches/cmake/teraterm/teraterm/tekwin_sub.h
===================================================================
--- branches/cmake/teraterm/teraterm/tekwin_sub.h	                        (rev 0)
+++ branches/cmake/teraterm/teraterm/tekwin_sub.h	2018-09-03 10:51:24 UTC (rev 7214)
@@ -0,0 +1,60 @@
+
+#pragma once
+
+#include <windows.h>
+#include "tmfc.h"
+
+#if 0
+class TTCDC
+{
+public:
+	HDC m_hDC;
+	BOOL operator=(const CDC& obj);
+	HDC GetSafeHdc() const;
+};
+#endif
+
+class TTCMenu
+{
+public:
+	HMENU m_hMenu;
+};
+
+class TTCFrameWnd : public TTCWnd
+{
+public:
+	TTCFrameWnd();
+	virtual ~TTCFrameWnd();
+	static TTCFrameWnd *pseudoPtr;
+	static LRESULT ProcStub(HWND hWnd, UINT msg, WPARAM wp, LPARAM lp);
+	virtual BOOL Create(HINSTANCE hInstance,
+						LPCTSTR lpszClassName,
+						LPCTSTR lpszWindowName,
+						DWORD dwStyle = WS_OVERLAPPEDWINDOW,
+						const RECT& rect = rectDefault,
+						HWND pParentWnd = NULL,        // != NULL for popups
+						LPCTSTR lpszMenuName = NULL,
+						DWORD dwExStyle = 0);//,
+						//CCreateContext* pContext = NULL);
+	virtual LRESULT Proc(UINT msg, WPARAM wp, LPARAM lp);
+	static const RECT rectDefault;
+	///
+	virtual BOOL OnCommand(WPARAM wParam, LPARAM lParam);
+//	static LRESULT AfxWndProc(UINT message, WPARAM wParam, LPARAM lParam);
+	///
+	void OnInitMenuPopup(TTCMenu* pPopupMenu, UINT nIndex, BOOL bSysMenu);
+	void OnKillFocus(TTCWnd* pNewWnd);
+	void OnDestroy();
+	void OnSetFocus(TTCWnd* pOldWnd);
+	void OnSysCommand(UINT nID, LPARAM lParam);
+	void OnSysKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
+	void OnSysKeyUp(UINT nChar, UINT nRepCnt, UINT nFlags);
+	void OnClose();
+};
+
+class TTCPoint {
+public:
+	int x;
+	int y;
+};
+

Modified: branches/cmake/teraterm/teraterm/teraprn.cpp
===================================================================
--- branches/cmake/teraterm/teraterm/teraprn.cpp	2018-09-03 10:51:20 UTC (rev 7213)
+++ branches/cmake/teraterm/teraterm/teraprn.cpp	2018-09-03 10:51:24 UTC (rev 7214)
@@ -28,7 +28,7 @@
  */
 
 /* TERATERM.EXE, Printing routines */
-#include "stdafx.h"
+//#include "stdafx.h"
 #include "teraterm.h"
 #include "tttypes.h"
 #include <commdlg.h>
@@ -44,12 +44,14 @@
 
 #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;

Modified: branches/cmake/teraterm/teraterm/teraterm.cpp
===================================================================
--- branches/cmake/teraterm/teraterm/teraterm.cpp	2018-09-03 10:51:20 UTC (rev 7213)
+++ branches/cmake/teraterm/teraterm/teraterm.cpp	2018-09-03 10:51:24 UTC (rev 7214)
@@ -51,6 +51,7 @@
 
 #include "compat_w95.h"
 
+#if 0
 #ifdef _DEBUG
 #define new DEBUG_NEW
 #undef THIS_FILE
@@ -61,8 +62,9 @@
 	//{{AFX_MSG_MAP(CTeraApp)
 	//}}AFX_MSG_MAP
 END_MESSAGE_MAP()
+#endif
 
-CTeraApp::CTeraApp()
+static void init()
 {
 	typedef BOOL (WINAPI *pSetDllDir)(LPCSTR);
 	typedef BOOL (WINAPI *pSetDefDllDir)(DWORD);
@@ -89,6 +91,7 @@
 	}
 }
 
+#if 0
 // CTeraApp instance
 CTeraApp theApp;
 
@@ -109,9 +112,10 @@
 {
 	return CWinApp::ExitInstance();
 }
+#endif
 
 // Tera Term main engine
-BOOL CTeraApp::OnIdle(LONG lCount)
+static BOOL OnIdle(LONG lCount)
 {
 	static int Busy = 2;
 	int Change, nx, ny;
@@ -246,3 +250,27 @@
 		return CWinApp::PreTranslateMessage(pMsg);
 	}
 }
+
+
+int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPreInst,
+                   LPSTR lpszCmdLine, int nCmdShow)
+{
+	hInst = hInstance;
+	CVTWindow *m_pMainWnd = new CVTWindow();
+	pVTWin = m_pMainWnd->m_hWnd;
+	ShowWindow(m_pMainWnd->m_hWnd, nCmdShow);
+
+	MSG msg;
+	while (GetMessage(&msg, NULL, 0, 0)) {
+        TranslateMessage(&msg);
+        DispatchMessage(&msg);
+    }
+    return (msg.wParam);
+}
+
+
+BOOL CallOnIdle(LONG lCount)
+{
+	CWinApp *app = AfxGetApp();
+	return app->OnIdle(lCount);
+}

Modified: branches/cmake/teraterm/teraterm/tmfc.cpp
===================================================================
--- branches/cmake/teraterm/teraterm/tmfc.cpp	2018-09-03 10:51:20 UTC (rev 7213)
+++ branches/cmake/teraterm/teraterm/tmfc.cpp	2018-09-03 10:51:24 UTC (rev 7214)
@@ -34,6 +34,12 @@
 #include <windowsx.h>
 #include "dlglib.h"
 
+TTCWnd::TTCWnd()
+{
+	m_hWnd = NULL;
+	m_hInst = NULL;
+}
+
 LRESULT TTCWnd::SendMessage(UINT msg, WPARAM wp, LPARAM lp)
 {
 	return ::SendMessage(m_hWnd, msg, wp, lp);

Modified: branches/cmake/teraterm/teraterm/tmfc.h
===================================================================
--- branches/cmake/teraterm/teraterm/tmfc.h	2018-09-03 10:51:20 UTC (rev 7213)
+++ branches/cmake/teraterm/teraterm/tmfc.h	2018-09-03 10:51:24 UTC (rev 7214)
@@ -38,8 +38,13 @@
 	HWND m_hWnd;
 	HINSTANCE m_hInst;
 
+	TTCWnd();
+	void DestroyWindow();
 	HWND GetSafeHwnd() const {return m_hWnd;}
 	HWND GetSafeHwnd() { return m_hWnd; }
+	HDC BeginPaint(LPPAINTSTRUCT lpPaint);
+	BOOL EndPaint(LPPAINTSTRUCT lpPaint);
+	virtual LRESULT DefWindowProc(UINT message, WPARAM wParam, LPARAM lParam);
 	LRESULT SendMessage(UINT msg, WPARAM wp, LPARAM lp);
 	LRESULT SendDlgItemMessage(int id, UINT msg, WPARAM wp, LPARAM lp);
 	void GetDlgItemText(int id, TCHAR *buf, size_t size);
@@ -64,10 +69,10 @@
 	TTCDialog();
 	virtual ~TTCDialog();
 	BOOL Create(HINSTANCE hInstance, HWND hParent, int idd);
+	void DestroyWindow();
 	virtual void OnInitDialog();
 	virtual	void OnOK();
 	virtual void OnCancel();
-	virtual void DestroyWindow();
 	virtual void PostNcDestroy();
 	virtual BOOL OnCommand(WPARAM wp, LPARAM lp);
 	HWND m_hParentWnd;

Modified: branches/cmake/teraterm/teraterm/vtwin.cpp
===================================================================
--- branches/cmake/teraterm/teraterm/vtwin.cpp	2018-09-03 10:51:20 UTC (rev 7213)
+++ branches/cmake/teraterm/teraterm/vtwin.cpp	2018-09-03 10:51:24 UTC (rev 7214)
@@ -30,7 +30,7 @@
 
 /* TERATERM.EXE, VT window */
 
-#include "stdafx.h"
+//#include "stdafx.h"
 #include <winsock2.h>
 #include <ws2tcpip.h>
 #include "teraterm.h"
@@ -51,7 +51,6 @@
 #include "filesys.h"
 #include "telnet.h"
 #include "tektypes.h"
-#include "tekwin.h"
 #include "ttdde.h"
 #include "ttlib.h"
 #include "dlglib.h"
@@ -63,11 +62,13 @@
 #include <stdlib.h>
 #include <string.h>
 #include <locale.h>
+#include <tchar.h>
 
 #include <shlobj.h>
 #include <io.h>
 #include <errno.h>
 #include <imagehlp.h>
+#include <crtdbg.h>
 
 #include <windowsx.h>
 #include <imm.h>
@@ -79,6 +80,8 @@
 #include "winjump.h"
 #include "sizetip.h"
 #include "dnddlg.h"
+#include "tekwin.h"
+#include "htmlhelp.h"
 
 #include "initguid.h"
 //#include "Usbiodef.h"
@@ -85,9 +88,14 @@
 DEFINE_GUID(GUID_DEVINTERFACE_USB_DEVICE, 0xA5DCBF10L, 0x6530, 0x11D2, 0x90, 0x1F, 0x00, \
              0xC0, 0x4F, 0xB9, 0x51, 0xED);
 
+#define CWnd	TTCWnd
+#define CFrameWnd	TTCFrameWnd
+#define CMenu TTCMenu
+#define CPoint	TTCPoint
+
 #define VTClassName "VTWin32"
 
-#ifdef _DEBUG
+#if 0 //def _DEBUG
 #define new DEBUG_NEW
 #undef THIS_FILE
 static char THIS_FILE[] = __FILE__;
@@ -114,6 +122,7 @@
 /////////////////////////////////////////////////////////////////////////////
 // CVTWindow
 
+#if 0
 BEGIN_MESSAGE_MAP(CVTWindow, CFrameWnd)
 	//{{AFX_MSG_MAP(CVTWindow)
 	ON_WM_ACTIVATE()
@@ -252,7 +261,13 @@
 	ON_MESSAGE(WM_USER_DROPNOTIFY, OnDropNotify)
 	//}}AFX_MSG_MAP
 END_MESSAGE_MAP()
+#endif
 
+static HINSTANCE AfxGetInstanceHandle()
+{
+	return hInst;
+}
+
 static BOOL MySetLayeredWindowAttributes(HWND hwnd, COLORREF crKey, BYTE bAlpha, DWORD dwFlags)
 {
 	typedef BOOL (WINAPI *func)(HWND,COLORREF,BYTE,DWORD);
@@ -673,7 +688,7 @@
 	BOOL isFirstInstance;
 
 #ifdef _DEBUG
-  ::_CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF);
+	::_CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF);
 #endif
 
 	// \x97\xE1\x8AO\x83n\x83\x93\x83h\x83\x89\x82̃t\x83b\x83N (2007.9.30 yutaka)
@@ -800,7 +815,8 @@
 #endif
 
 	wc.style = CS_DBLCLKS | CS_HREDRAW | CS_VREDRAW;
-	wc.lpfnWndProc = AfxWndProc;
+//	wc.lpfnWndProc = AfxWndProc;
+	wc.lpfnWndProc = (WNDPROC)ProcStub;
 	wc.cbClsExtra = 0;
 	wc.cbWndExtra = 0;
 	wc.hInstance = AfxGetInstanceHandle();
@@ -811,8 +827,9 @@
 	wc.lpszMenuName = NULL;
 	wc.lpszClassName = VTClassName;
 
-	RegisterClass(&wc);
-	LoadAccelTable(MAKEINTRESOURCE(IDR_ACC));
+	ATOM a = RegisterClass(&wc);
+	//LoadAccelTable(MAKEINTRESOURCE(IDR_ACC));
+	::LoadAccelerators(hInst, MAKEINTRESOURCE(IDR_ACC));
 
 	if (ts.VTPos.x==CW_USEDEFAULT) {
 		rect = rectDefault;
@@ -823,7 +840,7 @@
 		rect.right = rect.left + 100;
 		rect.bottom = rect.top + 100;
 	}
-	Create(VTClassName, "Tera Term", Style, rect, NULL, NULL);
+	Create(hInst, VTClassName, "Tera Term", Style, rect, NULL, NULL);
 
 	/*--------- Init2 -----------------*/
 	HVTWin = GetSafeHwnd();
@@ -921,7 +938,7 @@
 
 /////////////////////////////////////////////////////////////////////////////
 
-#ifdef _DEBUG
+#if 0 //def _DEBUG
 void CVTWindow::AssertValid() const
 {
 	CFrameWnd::AssertValid();
@@ -1028,7 +1045,7 @@
 	}
 
 	if (mousereport = MouseReport(IdMouseEventBtnDown, LMR, p.x, p.y)) {
-		SetCapture();
+		::SetCapture(m_hWnd);
 		return;
 	}
 
@@ -2247,6 +2264,7 @@
 				ts.TransBin = DropType == DROP_TYPE_SEND_FILE ? 0 : 1;
 				FileSendStart();
 #if 0
+#if 0
 				goto finish;	// send file\x82͘A\x91\xB1\x82\xB5\x82Ăł\xAB\x82Ȃ\xA2
 #else
 				{
@@ -2260,6 +2278,7 @@
 					}
 				}
 #endif
+#endif
 			}
 			break;
 		case DROP_TYPE_PASTE_FILENAME:
@@ -2329,7 +2348,7 @@
 #endif
 }
 
-void CVTWindow::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
+void CVTWindow::OnHScroll(UINT nSBCode, UINT nPos, HWND pScrollBar)
 {
 	int Func;
 
@@ -2556,12 +2575,22 @@
 }
 
 // \x83}\x83E\x83X\x83z\x83C\x81[\x83\x8B\x82̉\xF1\x93]
+LRESULT CVTWindow::OnMouseWheel(WPARAM wParam, LPARAM lParam)
+#if 0
 BOOL CVTWindow::OnMouseWheel(
 	UINT nFlags,   // \x89\xBC\x91z\x83L\x81[
 	short zDelta,  // \x89\xF1\x93]\x8B\x97\x97\xA3
 	CPoint pt      // \x83J\x81[\x83\\x83\x8B\x88ʒu
 )
+#endif
 {
+	UINT nFlags = GET_KEYSTATE_WPARAM(wParam);		// \x89\xBC\x91z\x83L\x81[
+	short zDelta = GET_WHEEL_DELTA_WPARAM(wParam);	// \x89\xF1\x93]\x8B\x97\x97\xA3
+	POINTS pts = MAKEPOINTS(lParam);				// \x83J\x81[\x83\\x83\x8B\x88ʒu
+	POINT pt;
+	pt.x = pts.x;
+	pt.y = pts.y;
+
 	int line, i;
 
 	::ScreenToClient(HVTWin, &pt);
@@ -2597,11 +2626,13 @@
 	return (TRUE);
 }
 
+#if 0
 void CVTWindow::OnNcCalcSize(BOOL valid, NCCALCSIZE_PARAMS *sizeinfo)
 {
 	CWnd::OnNcCalcSize(valid, sizeinfo);
 	return;
 }
+#endif
 
 void CVTWindow::OnNcLButtonDblClk(UINT nHitTest, CPoint point)
 {
@@ -2609,7 +2640,7 @@
 		DispRestoreWinSize();
 	}
 	else {
-		CFrameWnd::OnNcLButtonDblClk(nHitTest,point);
+//TODO		CFrameWnd::OnNcLButtonDblClk(nHitTest,point);
 	}
 }
 
@@ -2625,7 +2656,7 @@
 void CVTWindow::OnPaint()
 {
 	PAINTSTRUCT ps;
-	CDC *cdc;
+//	CDC *cdc;
 	HDC PaintDC;
 	int Xs, Ys, Xe, Ye;
 
@@ -2635,8 +2666,8 @@
 //-->
 #endif
 
-	cdc = BeginPaint(&ps);
-	PaintDC = cdc->GetSafeHdc();
+	PaintDC = BeginPaint(&ps);
+//	PaintDC = cdc->GetSafeHdc();
 
 	PaintWindow(PaintDC,ps.rcPaint,ps.fErase, &Xs,&Ys,&Xe,&Ye);
 	LockBuffer();
@@ -2848,7 +2879,7 @@
 		break;
 	}
 
-	CFrameWnd::OnSizing(fwSide, pRect);
+//TODO	CFrameWnd::OnSizing(fwSide, pRect);
 }
 
 void CVTWindow::OnSysChar(UINT nChar, UINT nRepCnt, UINT nFlags)
@@ -2861,7 +2892,7 @@
 	// ALT + x\x82\xF0\x89\x9F\x89\xBA\x82\xB7\x82\xE9\x82\xC6 WM_SYSCHAR \x82\xAA\x94\xF2\x82\xF1\x82ł\xAD\x82\xE9\x81B
 	// ALT + Enter\x82ŃE\x83B\x83\x93\x83h\x83E\x82̍ő剻 (2005.4.24 yutaka)
 	if ((nFlags&0x2000) != 0 && nChar == CR) {
-		if (IsZoomed()) { // window is maximum
+		if (::IsZoomed(m_hWnd)) { // window is maximum
 			ShowWindow(SW_RESTORE);
 		} else {
 			ShowWindow(SW_MAXIMIZE);
@@ -2900,13 +2931,15 @@
 		return;
 	}
 
-	CFrameWnd::OnSysChar(nChar, nRepCnt, nFlags);
+//	CFrameWnd::OnSysChar(nChar, nRepCnt, nFlags);
 }
 
+#if 0
 void CVTWindow::OnSysColorChange()
 {
 	CFrameWnd::OnSysColorChange();
 }
+#endif
 
 void CVTWindow::OnSysCommand(UINT nID, LPARAM lParam)
 {
@@ -2995,7 +3028,7 @@
 		case IdComEndTimer:
 			if (! CommCanClose(&cv)) {
 				// wait if received data remains
-				SetTimer(IdComEndTimer,1,NULL);
+				::SetTimer(m_hWnd, IdComEndTimer,1,NULL);
 				break;
 			}
 			cv.Ready = FALSE;
@@ -3031,7 +3064,7 @@
 	}
 }
 
-void CVTWindow::OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
+void CVTWindow::OnVScroll(UINT nSBCode, UINT nPos, HWND pScrollBar)
 {
 	int Func;
 	SCROLLINFO si;
@@ -3142,8 +3175,8 @@
 		}
 		break;
 	}
-
-	return CFrameWnd::OnDeviceChange(nEventType, dwData);
+	return TRUE;
+//TODO	return CFrameWnd::OnDeviceChange(nEventType, dwData);
 }
 
 //<!--by AKASI
@@ -3572,7 +3605,7 @@
 			cv.OutBuffCount = 0;
 			cv.LineModeBuffCount = 0;
 			cv.FlushLen = 0;
-			SetTimer(IdComEndTimer,1,NULL);
+			::SetTimer(m_hWnd, IdComEndTimer,1,NULL);
 			break;
 	}
 	return 0;
@@ -4701,7 +4734,7 @@
 		int w, h;
 
 #ifdef WINDOW_MAXMIMUM_ENABLED
-		if (IsZoomed()) {
+		if (::IsZoomed(m_hWnd)) {
 			w = ts.TerminalWidth;
 			h = ts.TerminalHeight;
 			ts.TerminalWidth = ts.TerminalOldWidth;
@@ -4717,7 +4750,7 @@
 		FreeTTSET();
 
 #ifdef WINDOW_MAXMIMUM_ENABLED
-		if (IsZoomed()) {
+		if (::IsZoomed(m_hWnd)) {
 			ts.TerminalWidth = w;
 			ts.TerminalHeight = h;
 		}
@@ -5935,7 +5968,7 @@
 	}
 
 	// \x83_\x83C\x83A\x83\x8D\x83O\x82\xF0\x83E\x83B\x83\x93\x83h\x83E\x82̐^\x8F\xE3\x82ɔz\x92u\x82\xB7\x82\xE9 (2008.1.25 yutaka)
-	GetWindowRect(&prc);
+	::GetWindowRect(m_hWnd, &prc);
 	::GetWindowRect(hDlgWnd, &rc);
 	x = prc.left;
 	y = prc.top - (rc.bottom - rc.top);
@@ -6009,7 +6042,7 @@
 	// \x82\xE6\x82\xC1\x82čs\x82\xED\x82\xEA\x82\xE9\x81B
 	// \x82\xB5\x82\xA9\x82\xB5\x94\xF1\x83A\x83N\x83e\x83B\x83u\x82ȃE\x83B\x83\x93\x83h\x83E\x82ł\xCD OnIdle() \x82\xAA\x8CĂ΂\xEA\x82Ȃ\xA2\x82̂ŁA
 	// \x8B\xF3\x82̃\x81\x83b\x83Z\x81[\x83W\x82𑗂\xC1\x82\xC4 OnIdle() \x82\xAA\x8CĂ΂\xEA\x82\xE9\x82悤\x82ɂ\xB7\x82\xE9\x81B
-	PostMessage(WM_NULL, 0, 0);
+	::PostMessage(m_hWnd, WM_NULL, 0, 0);
 
 	return 1; // \x91\x97\x90M\x82ł\xAB\x82\xBD\x8Fꍇ\x82\xCD1\x82\xF0\x95Ԃ\xB7
 }
@@ -6098,10 +6131,3 @@
 	(*AboutDialog)(HVTWin);
 	FreeTTDLG();
 }
-
-
-BOOL CallOnIdle(LONG lCount)
-{
-	CWinApp *app = AfxGetApp();
-	return app->OnIdle(lCount);
-}

Modified: branches/cmake/teraterm/teraterm/vtwin.h
===================================================================
--- branches/cmake/teraterm/teraterm/vtwin.h	2018-09-03 10:51:20 UTC (rev 7213)
+++ branches/cmake/teraterm/teraterm/vtwin.h	2018-09-03 10:51:24 UTC (rev 7214)
@@ -31,7 +31,9 @@
 
 #ifdef __cplusplus
 
-class CVTWindow : public CFrameWnd
+#include "tekwin_sub.h"
+//class CVTWindow : public CFrameWnd
+class CVTWindow : public TTCFrameWnd
 {
 private:
   BOOL FirstPaint, Minimized;
@@ -80,14 +82,15 @@
 	//}}AFX_VIRTUAL
 
 public:
-#ifdef _DEBUG
+#if 0 //def _DEBUG
 	virtual void AssertValid() const;
-	virtual void Dump(CDumpContext& dc) const;
+//	virtual void Dump(CDumpContext& dc) const;
 #endif
 
 protected:
 	//{{AFX_MSG(CVTWindow)
-	afx_msg void OnActivate(UINT nState, CWnd* pWndOther, BOOL bMinimized);
+#define afx_msg
+	afx_msg void OnActivate(UINT nState, TTCWnd* pWndOther, BOOL bMinimized);
 	afx_msg void OnChar(UINT nChar, UINT nRepCnt, UINT nFlags);
 	afx_msg void OnClose();
 	afx_msg void OnAllClose();
@@ -94,27 +97,29 @@
 	afx_msg void OnDestroy();
 	afx_msg void OnDropFiles(HDROP hDropInfo);
 	afx_msg void OnGetMinMaxInfo(MINMAXINFO *lpMMI);
-	afx_msg void OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
-	afx_msg void OnInitMenuPopup(CMenu* pPopupMenu, UINT nIndex, BOOL bSysMenu);
+	afx_msg void OnHScroll(UINT nSBCode, UINT nPos, HWND pScrollBar);
+//	afx_msg void OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
+	afx_msg void OnInitMenuPopup(TTCMenu* pPopupMenu, 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 OnLButtonDblClk(UINT nFlags, CPoint point);
-	afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
-	afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
-	afx_msg void OnMButtonDown(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(TTCWnd* pNewWnd);
+	afx_msg void OnLButtonDblClk(UINT nFlags, TTCPoint point);
+	afx_msg void OnLButtonDown(UINT nFlags, TTCPoint point);
+	afx_msg void OnLButtonUp(UINT nFlags, TTCPoint point);
+	afx_msg void OnMButtonDown(UINT nFlags, TTCPoint point);
+	afx_msg void OnMButtonUp(UINT nFlags, TTCPoint point);
+	afx_msg int OnMouseActivate(TTCWnd* pDesktopWnd, UINT nHitTest, UINT message);
+	afx_msg void OnMouseMove(UINT nFlags, TTCPoint point);
 	afx_msg void OnMove(int x, int y);
-	afx_msg BOOL OnMouseWheel(UINT nFlags, short zDelta, CPoint pt);
-	afx_msg void OnNcCalcSize(BOOL valid, NCCALCSIZE_PARAMS *calcsize);
-	afx_msg void OnNcLButtonDblClk(UINT nHitTest, CPoint point);
-	afx_msg void OnNcRButtonDown(UINT nHitTest, CPoint point);
+//	afx_msg BOOL OnMouseWheel(UINT nFlags, short zDelta, TTCPoint pt);
+	afx_msg LRESULT OnMouseWheel(WPARAM wParam, LPARAM lParam);
+//	afx_msg void OnNcCalcSize(BOOL valid, NCCALCSIZE_PARAMS *calcsize);
+	afx_msg void OnNcLButtonDblClk(UINT nHitTest, TTCPoint point);
+	afx_msg void OnNcRButtonDown(UINT nHitTest, TTCPoint point);
 	afx_msg void OnPaint();
-	afx_msg void OnRButtonDown(UINT nFlags, CPoint point);
-	afx_msg void OnRButtonUp(UINT nFlags, CPoint point);
-	afx_msg void OnSetFocus(CWnd* pOldWnd);
+	afx_msg void OnRButtonDown(UINT nFlags, TTCPoint point);
+	afx_msg void OnRButtonUp(UINT nFlags, TTCPoint point);
+	afx_msg void OnSetFocus(TTCWnd* pOldWnd);
 	afx_msg void OnSize(UINT nType, int cx, int cy);
 	afx_msg void OnSizing(UINT fwSide, LPRECT pRect);
 	afx_msg void OnSysChar(UINT nChar, UINT nRepCnt, UINT nFlags);
@@ -123,7 +128,8 @@
 	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_PTR nIDEvent);
-	afx_msg void OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
+//	afx_msg void OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
+	afx_msg void OnVScroll(UINT nSBCode, UINT nPos, HWND pScrollBar);
 	afx_msg BOOL OnDeviceChange(UINT nEventType, DWORD_PTR dwData);
 //<!--by AKASI
 	afx_msg LRESULT OnWindowPosChanging(WPARAM wParam, LPARAM lParam);
@@ -223,7 +229,8 @@
 	afx_msg void OnHelpAbout();
 	afx_msg LRESULT OnDropNotify(WPARAM ShowMenu, LPARAM lParam);
 	//}}AFX_MSG
-	DECLARE_MESSAGE_MAP();
+//	DECLARE_MESSAGE_MAP();
+#undef afx_msg
 	void Disconnect(BOOL confirm);
 };
 #endif



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