svnno****@sourc*****
svnno****@sourc*****
2015年 7月 13日 (月) 01:17:06 JST
Revision: 5910 http://sourceforge.jp/projects/ttssh2/scm/svn/commits/5910 Author: maya Date: 2015-07-13 01:17:06 +0900 (Mon, 13 Jul 2015) Log Message: ----------- filenamebox と dirnamebox を最前面に表示するために、マクロウィンドウを最前面にする http://osdn.jp/ticket/browse.php?group_id=1412&tid=35293 Modified Paths: -------------- trunk/teraterm/ttpmacro/ttl.c trunk/teraterm/ttpmacro/ttmlib.c trunk/teraterm/ttpmacro/ttmlib.h -------------- next part -------------- Modified: trunk/teraterm/ttpmacro/ttl.c =================================================================== --- trunk/teraterm/ttpmacro/ttl.c 2015-07-11 16:37:16 UTC (rev 5909) +++ trunk/teraterm/ttpmacro/ttl.c 2015-07-12 16:17:06 UTC (rev 5910) @@ -1455,6 +1455,7 @@ if (strlen(InitDir) > 0) { ofn.lpstrInitialDir = InitDir; } + BringupWindow(HMainWin); if (SaveFlag) { ofn.Flags = OFN_OVERWRITEPROMPT; ret = GetSaveFileName(&ofn); @@ -3351,7 +3352,8 @@ SetInputStr(""); if (CheckVar("inputstr", &ValType, &VarId) && - (ValType == TypString)) { + (ValType == TypString)) { + BringupWindow(HMainWin); if (doSelectFolder(HMainWin, buf, sizeof(buf), InitDir, Title)) { SetInputStr(buf); ret = 1; Modified: trunk/teraterm/ttpmacro/ttmlib.c =================================================================== --- trunk/teraterm/ttpmacro/ttmlib.c 2015-07-11 16:37:16 UTC (rev 5909) +++ trunk/teraterm/ttpmacro/ttmlib.c 2015-07-12 16:17:06 UTC (rev 5910) @@ -213,3 +213,22 @@ return mi.rcWork.left; } } + +void BringupWindow(HWND hWnd) +{ + DWORD thisThreadId; + DWORD fgThreadId; + + thisThreadId = GetWindowThreadProcessId(hWnd, NULL); + fgThreadId = GetWindowThreadProcessId(GetForegroundWindow(), NULL); + + if (thisThreadId == fgThreadId) { + SetForegroundWindow(hWnd); + BringWindowToTop(hWnd); + } else { + AttachThreadInput(thisThreadId, fgThreadId, TRUE); + SetForegroundWindow(hWnd); + BringWindowToTop(hWnd); + AttachThreadInput(thisThreadId, fgThreadId, FALSE); + } +} Modified: trunk/teraterm/ttpmacro/ttmlib.h =================================================================== --- trunk/teraterm/ttpmacro/ttmlib.h 2015-07-11 16:37:16 UTC (rev 5909) +++ trunk/teraterm/ttpmacro/ttmlib.h 2015-07-12 16:17:06 UTC (rev 5910) @@ -16,6 +16,7 @@ int GetAbsPath(PCHAR FName, int destlen); int GetSpecialFolder(PCHAR dest, int dest_len, PCHAR type); int GetMonitorLeftmost(int PosX, int PosY); +void BringupWindow(HWND hWnd); #ifdef __cplusplus }