[Ttssh2-commit] [8352] 各ダイアログに HINSTANCE を引数で渡すようにした

Back to archive index
scmno****@osdn***** scmno****@osdn*****
2019年 10月 30日 (水) 22:33:02 JST


Revision: 8352
          https://osdn.net/projects/ttssh2/scm/svn/commits/8352
Author:   zmatsuo
Date:     2019-10-30 22:33:02 +0900 (Wed, 30 Oct 2019)
Log Message:
-----------
各ダイアログに HINSTANCE を引数で渡すようにした

- グローバル関数をダイアログのソース内で使用しないようにした
  - GetInstance(), GetHWND()

Modified Paths:
--------------
    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/ttmdlg.cpp

-------------- next part --------------
Modified: trunk/teraterm/ttpmacro/ListDlg.cpp
===================================================================
--- trunk/teraterm/ttpmacro/ListDlg.cpp	2019-10-30 13:32:47 UTC (rev 8351)
+++ trunk/teraterm/ttpmacro/ListDlg.cpp	2019-10-30 13:33:02 UTC (rev 8352)
@@ -37,7 +37,6 @@
 #include "tttypes.h"
 #include "dlglib.h"
 #include "ttmdlg.h"
-#include "ttmacro.h"
 
 #include "ListDlg.h"
 
@@ -53,10 +52,8 @@
 	PosY = y;
 }
 
-INT_PTR CListDlg::DoModal()
+INT_PTR CListDlg::DoModal(HINSTANCE hInst, HWND hWndParent)
 {
-	HINSTANCE hInst = GetInstance();
-	HWND hWndParent = GetHWND();
 	return TTCDialog::DoModal(hInst, hWndParent, IDD);
 }
 

Modified: trunk/teraterm/ttpmacro/ListDlg.h
===================================================================
--- trunk/teraterm/ttpmacro/ListDlg.h	2019-10-30 13:32:47 UTC (rev 8351)
+++ trunk/teraterm/ttpmacro/ListDlg.h	2019-10-30 13:33:02 UTC (rev 8352)
@@ -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
@@ -32,7 +32,7 @@
 {
 public:
 	CListDlg(PCHAR Text, PCHAR Caption, const CHAR **Lists, int Selected, int x, int y);
-	INT_PTR DoModal();
+	INT_PTR DoModal(HINSTANCE hInst, HWND hWndParent);
 	int m_SelectItem;
 
 private:

Modified: trunk/teraterm/ttpmacro/errdlg.cpp
===================================================================
--- trunk/teraterm/ttpmacro/errdlg.cpp	2019-10-30 13:32:47 UTC (rev 8351)
+++ trunk/teraterm/ttpmacro/errdlg.cpp	2019-10-30 13:33:02 UTC (rev 8352)
@@ -1,6 +1,6 @@
 /*
  * Copyright (C) 1994-1998 T. Teranishi
- * (C) 2007-2017 TeraTerm Project
+ * (C) 2007-2019 TeraTerm Project
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -43,7 +43,6 @@
 #include "ttmparse.h"
 #include "htmlhelp.h"
 #include "dlglib.h"
-#include "ttmacro.h"
 
 #include "errdlg.h"
 
@@ -61,11 +60,9 @@
 	MacroFileName = FileName;
 }
 
-INT_PTR CErrDlg::DoModal()
+INT_PTR CErrDlg::DoModal(HINSTANCE hInst, HWND hWndParent)
 {
-	HINSTANCE hInst = GetInstance();
-	HWND parent = GetHWND();
-	return TTCDialog::DoModal(hInst, parent, CErrDlg::IDD);
+	return TTCDialog::DoModal(hInst, hWndParent, CErrDlg::IDD);
 }
 
 BOOL CErrDlg::OnInitDialog()

Modified: trunk/teraterm/ttpmacro/errdlg.h
===================================================================
--- trunk/teraterm/ttpmacro/errdlg.h	2019-10-30 13:32:47 UTC (rev 8351)
+++ trunk/teraterm/ttpmacro/errdlg.h	2019-10-30 13:33:02 UTC (rev 8352)
@@ -1,6 +1,6 @@
 /*
  * Copyright (C) 1994-1998 T. Teranishi
- * (C) 2007-2017 TeraTerm Project
+ * (C) 2007-2019 TeraTerm Project
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -36,7 +36,7 @@
 {
 public:
 	CErrDlg(const char *Msg, PCHAR Line, int x, int y, int lineno, int start, int end, PCHAR FileName);
-	INT_PTR DoModal();
+	INT_PTR DoModal(HINSTANCE hInst, HWND hWndParent);
 
 private:
 	enum { IDD = IDD_ERRDLG };

Modified: trunk/teraterm/ttpmacro/inpdlg.cpp
===================================================================
--- trunk/teraterm/ttpmacro/inpdlg.cpp	2019-10-30 13:32:47 UTC (rev 8351)
+++ trunk/teraterm/ttpmacro/inpdlg.cpp	2019-10-30 13:33:02 UTC (rev 8352)
@@ -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
@@ -35,7 +35,6 @@
 #include "ttm_res.h"
 #include "ttmlib.h"
 #include "dlglib.h"
-#include "ttmacro.h"
 #include "compat_win.h"
 
 #include "inpdlg.h"
@@ -54,11 +53,9 @@
 	PosY = y;
 }
 
-INT_PTR CInpDlg::DoModal()
+INT_PTR CInpDlg::DoModal(HINSTANCE hInst, HWND hWndParent)
 {
-	HINSTANCE hInst = GetInstance();
-	HWND parent = GetHWND();
-	return TTCDialog::DoModal(hInst, parent, CInpDlg::IDD);
+	return TTCDialog::DoModal(hInst, hWndParent, CInpDlg::IDD);
 }
 
 // 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)

Modified: trunk/teraterm/ttpmacro/inpdlg.h
===================================================================
--- trunk/teraterm/ttpmacro/inpdlg.h	2019-10-30 13:32:47 UTC (rev 8351)
+++ trunk/teraterm/ttpmacro/inpdlg.h	2019-10-30 13:33:02 UTC (rev 8352)
@@ -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
@@ -37,7 +37,7 @@
 	CInpDlg(PCHAR Input, PCHAR Text, PCHAR Title,
 	        PCHAR Default, BOOL Paswd,
 	        int x, int y);
-	INT_PTR DoModal();
+	INT_PTR DoModal(HINSTANCE hInst, HWND hWndParent);
 
 private:
 	enum { IDD = IDD_INPDLG };

Modified: trunk/teraterm/ttpmacro/msgdlg.cpp
===================================================================
--- trunk/teraterm/ttpmacro/msgdlg.cpp	2019-10-30 13:32:47 UTC (rev 8351)
+++ trunk/teraterm/ttpmacro/msgdlg.cpp	2019-10-30 13:33:02 UTC (rev 8352)
@@ -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
@@ -38,7 +38,6 @@
 #include "tmfc.h"
 #include "dlglib.h"
 #include "ttmdlg.h"
-#include "ttmacro.h"
 #include "compat_win.h"
 
 #include "msgdlg.h"
@@ -55,10 +54,8 @@
 	PosY = y;
 }
 
-INT_PTR CMsgDlg::DoModal()
+INT_PTR CMsgDlg::DoModal(HINSTANCE hInst, HWND hWndParent)
 {
-	HINSTANCE hInst = GetInstance();
-	HWND hWndParent = GetHWND();
 	return TTCDialog::DoModal(hInst, hWndParent, CMsgDlg::IDD);
 }
 

Modified: trunk/teraterm/ttpmacro/msgdlg.h
===================================================================
--- trunk/teraterm/ttpmacro/msgdlg.h	2019-10-30 13:32:47 UTC (rev 8351)
+++ trunk/teraterm/ttpmacro/msgdlg.h	2019-10-30 13:33:02 UTC (rev 8352)
@@ -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
@@ -35,7 +35,7 @@
 {
 public:
 	CMsgDlg(const TCHAR *Text, const TCHAR *Title, BOOL YesNo, int x, int y);
-	INT_PTR DoModal();
+	INT_PTR DoModal(HINSTANCE hInst, HWND hWndParent);
 
 private:
 	enum { IDD = IDD_MSGDLG };

Modified: trunk/teraterm/ttpmacro/statdlg.cpp
===================================================================
--- trunk/teraterm/ttpmacro/statdlg.cpp	2019-10-30 13:32:47 UTC (rev 8351)
+++ trunk/teraterm/ttpmacro/statdlg.cpp	2019-10-30 13:33:02 UTC (rev 8352)
@@ -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
@@ -37,19 +37,17 @@
 #include "ttmlib.h"
 #include "tmfc.h"
 #include "tttypes.h"
-#include "ttmacro.h"
 
 #include "statdlg.h"
 
 // CStatDlg dialog
 
-BOOL CStatDlg::Create(PCHAR Text, PCHAR Title, int x, int y)
+BOOL CStatDlg::Create(HINSTANCE hInst, PCHAR Text, PCHAR Title, int x, int y)
 {
 	TextStr = Text;
 	TitleStr = Title;
 	PosX = x;
 	PosY = y;
-	HINSTANCE hInst = GetInstance();
 	return TTCDialog::Create(hInst, GetDesktopWindow(), CStatDlg::IDD);
 }
 

Modified: trunk/teraterm/ttpmacro/statdlg.h
===================================================================
--- trunk/teraterm/ttpmacro/statdlg.h	2019-10-30 13:32:47 UTC (rev 8351)
+++ trunk/teraterm/ttpmacro/statdlg.h	2019-10-30 13:33:02 UTC (rev 8352)
@@ -1,6 +1,6 @@
 /*
  * Copyright (C) 1994-1998 T. Teranishi
- * (C) 2007-2017 TeraTerm Project
+ * (C) 2007-2019 TeraTerm Project
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -32,7 +32,7 @@
 class CStatDlg : public TTCDialog
 {
 public:
-	BOOL Create(PCHAR Text, PCHAR Title, int x, int y);
+	BOOL Create(HINSTANCE hInst, PCHAR Text, PCHAR Title, int x, int y);
 	void Update(PCHAR Text, PCHAR Title, int x, int y);
 	void Bringup();
 	enum { IDD = IDD_STATDLG };

Modified: trunk/teraterm/ttpmacro/ttmdlg.cpp
===================================================================
--- trunk/teraterm/ttpmacro/ttmdlg.cpp	2019-10-30 13:32:47 UTC (rev 8351)
+++ trunk/teraterm/ttpmacro/ttmdlg.cpp	2019-10-30 13:33:02 UTC (rev 8352)
@@ -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
@@ -226,27 +226,34 @@
 void OpenInpDlg(PCHAR Buff, PCHAR Text, PCHAR Caption,
                 PCHAR Default, BOOL Paswd)
 {
+	HINSTANCE hInst = GetInstance();
+	HWND hWndParent = GetHWND();
 	CInpDlg InpDlg(Buff,Text,Caption,Default,Paswd,DlgPosX,DlgPosY);
-	InpDlg.DoModal();
+	InpDlg.DoModal(hInst, hWndParent);
 }
 
 int OpenErrDlg(const char *Msg, PCHAR Line, int lineno, int start, int end, PCHAR FileName)
 {
+	HINSTANCE hInst = GetInstance();
+	HWND hWndParent = GetHWND();
 	CErrDlg ErrDlg(Msg,Line,DlgPosX,DlgPosY, lineno, start, end, FileName);
-	return ErrDlg.DoModal();
+	return ErrDlg.DoModal(hInst, hWndParent);
 }
 
 int OpenMsgDlg(PCHAR Text, PCHAR Caption, BOOL YesNo)
 {
+	HINSTANCE hInst = GetInstance();
+	HWND hWndParent = GetHWND();
 	CMsgDlg MsgDlg(Text,Caption,YesNo,DlgPosX,DlgPosY);
-	return MsgDlg.DoModal();
+	return MsgDlg.DoModal(hInst, hWndParent);
 }
 
 void OpenStatDlg(PCHAR Text, PCHAR Caption)
 {
 	if (StatDlg==NULL) {
+		HINSTANCE hInst = GetInstance();
 		StatDlg = new CStatDlg();
-		StatDlg->Create(Text,Caption,DlgPosX,DlgPosY);
+		StatDlg->Create(hInst,Text,Caption,DlgPosX,DlgPosY);
 	}
 	else {// if status box already exists,
 		// update text and caption only.
@@ -280,8 +287,10 @@
  */
 int OpenListDlg(PCHAR Text, PCHAR Caption, const CHAR **Lists, int Selected)
 {
+	HINSTANCE hInst = GetInstance();
+	HWND hWndParent = GetHWND();
 	CListDlg ListDlg(Text, Caption, Lists, Selected, DlgPosX, DlgPosY);
-	INT_PTR r = ListDlg.DoModal();
+	INT_PTR r = ListDlg.DoModal(hInst, hWndParent);
 	if (r == IDOK) {
 		return ListDlg.m_SelectItem;
 	}


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