svnno****@sourc*****
svnno****@sourc*****
2013年 5月 25日 (土) 08:57:51 JST
Revision: 5282 http://sourceforge.jp/projects/ttssh2/scm/svn/commits/5282 Author: maya Date: 2013-05-25 08:57:50 +0900 (Sat, 25 May 2013) Log Message: ----------- box 系マクロコマンドの表示時に、ダイアログを最前面に持ってくるようにした statusbox は bringupbox で制御できるので対象外 Modified Paths: -------------- trunk/teraterm/ttpmacro/ListDlg.cpp trunk/teraterm/ttpmacro/ListDlg.h trunk/teraterm/ttpmacro/inpdlg.cpp trunk/teraterm/ttpmacro/inpdlg.h trunk/teraterm/ttpmacro/msgdlg.cpp trunk/teraterm/ttpmacro/msgdlg.h -------------- next part -------------- Modified: trunk/teraterm/ttpmacro/ListDlg.cpp =================================================================== --- trunk/teraterm/ttpmacro/ListDlg.cpp 2013-05-24 14:55:44 UTC (rev 5281) +++ trunk/teraterm/ttpmacro/ListDlg.cpp 2013-05-24 23:57:50 UTC (rev 5282) @@ -140,7 +140,7 @@ Relocation(TRUE, WW); - SetForegroundWindow(); + Bringup(); 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 @@ -204,3 +204,23 @@ InvalidateRect(NULL); } + +void CListDlg::Bringup() +{ + DWORD pid; + DWORD thisThreadId; + DWORD fgThreadId; + + thisThreadId = GetWindowThreadProcessId(GetSafeHwnd(), &pid); + fgThreadId = GetWindowThreadProcessId(::GetForegroundWindow(), &pid); + + if (thisThreadId == fgThreadId) { + SetForegroundWindow(); + BringWindowToTop(); + } else { + AttachThreadInput(thisThreadId, fgThreadId, TRUE); + SetForegroundWindow(); + BringWindowToTop(); + AttachThreadInput(thisThreadId, fgThreadId, FALSE); + } +} Modified: trunk/teraterm/ttpmacro/ListDlg.h =================================================================== --- trunk/teraterm/ttpmacro/ListDlg.h 2013-05-24 14:55:44 UTC (rev 5281) +++ trunk/teraterm/ttpmacro/ListDlg.h 2013-05-24 23:57:50 UTC (rev 5282) @@ -25,6 +25,7 @@ HFONT DlgFont; void Relocation(BOOL is_init, int WW); + void Bringup(); DECLARE_MESSAGE_MAP() public: Modified: trunk/teraterm/ttpmacro/inpdlg.cpp =================================================================== --- trunk/teraterm/ttpmacro/inpdlg.cpp 2013-05-24 14:55:44 UTC (rev 5281) +++ trunk/teraterm/ttpmacro/inpdlg.cpp 2013-05-24 23:57:50 UTC (rev 5282) @@ -100,7 +100,7 @@ Relocation(TRUE, WW); - SetForegroundWindow(); + Bringup(); return TRUE; } @@ -186,3 +186,24 @@ InvalidateRect(NULL); } + + +void CInpDlg::Bringup() +{ + DWORD pid; + DWORD thisThreadId; + DWORD fgThreadId; + + thisThreadId = GetWindowThreadProcessId(GetSafeHwnd(), &pid); + fgThreadId = GetWindowThreadProcessId(::GetForegroundWindow(), &pid); + + if (thisThreadId == fgThreadId) { + SetForegroundWindow(); + BringWindowToTop(); + } else { + AttachThreadInput(thisThreadId, fgThreadId, TRUE); + SetForegroundWindow(); + BringWindowToTop(); + AttachThreadInput(thisThreadId, fgThreadId, FALSE); + } +} Modified: trunk/teraterm/ttpmacro/inpdlg.h =================================================================== --- trunk/teraterm/ttpmacro/inpdlg.h 2013-05-24 14:55:44 UTC (rev 5281) +++ trunk/teraterm/ttpmacro/inpdlg.h 2013-05-24 23:57:50 UTC (rev 5282) @@ -31,6 +31,7 @@ afx_msg LONG OnExitSizeMove(UINT wParam, LONG lParam); //}}AFX_MSG void Relocation(BOOL is_init, int WW); + void Bringup(); DECLARE_MESSAGE_MAP() }; typedef CInpDlg *PInpDlg; Modified: trunk/teraterm/ttpmacro/msgdlg.cpp =================================================================== --- trunk/teraterm/ttpmacro/msgdlg.cpp 2013-05-24 14:55:44 UTC (rev 5281) +++ trunk/teraterm/ttpmacro/msgdlg.cpp 2013-05-24 23:57:50 UTC (rev 5282) @@ -90,7 +90,7 @@ Relocation(TRUE, WW); - SetForegroundWindow(); + Bringup(); return TRUE; } @@ -211,3 +211,22 @@ } } +void CMsgDlg::Bringup() +{ + DWORD pid; + DWORD thisThreadId; + DWORD fgThreadId; + + thisThreadId = GetWindowThreadProcessId(GetSafeHwnd(), &pid); + fgThreadId = GetWindowThreadProcessId(::GetForegroundWindow(), &pid); + + if (thisThreadId == fgThreadId) { + SetForegroundWindow(); + BringWindowToTop(); + } else { + AttachThreadInput(thisThreadId, fgThreadId, TRUE); + SetForegroundWindow(); + BringWindowToTop(); + AttachThreadInput(thisThreadId, fgThreadId, FALSE); + } +} Modified: trunk/teraterm/ttpmacro/msgdlg.h =================================================================== --- trunk/teraterm/ttpmacro/msgdlg.h 2013-05-24 14:55:44 UTC (rev 5281) +++ trunk/teraterm/ttpmacro/msgdlg.h 2013-05-24 23:57:50 UTC (rev 5282) @@ -30,5 +30,6 @@ afx_msg LONG OnExitSizeMove(UINT wParam, LONG lParam); //}}AFX_MSG void Relocation(BOOL is_init, int WW); + void Bringup(); DECLARE_MESSAGE_MAP() };