svnno****@sourc*****
svnno****@sourc*****
2009年 10月 3日 (土) 23:44:54 JST
Revision: 3629 http://sourceforge.jp/projects/ttssh2/svn/view?view=rev&revision=3629 Author: yutakapon Date: 2009-10-03 23:44:54 +0900 (Sat, 03 Oct 2009) Log Message: ----------- 定期的に、Tera Termインスタンスの個数の変化を検出し、Broadcast Commandリストを更新するようにした。 Modified Paths: -------------- trunk/teraterm/teraterm/vtwin.cpp -------------- next part -------------- Modified: trunk/teraterm/teraterm/vtwin.cpp =================================================================== --- trunk/teraterm/teraterm/vtwin.cpp 2009-10-03 13:08:37 UTC (rev 3628) +++ trunk/teraterm/teraterm/vtwin.cpp 2009-10-03 14:44:54 UTC (rev 3629) @@ -4364,6 +4364,21 @@ } +static int GetApplicationInstanceCount(void) +{ + int i; + HWND hd; + + for (i = 0 ; i < MAXNWIN ; i++) { // 50 = MAXNWIN(@ ttcmn.c) + hd = GetNthWin(i); + if (hd == NULL) { + break; + } + } + return (i); +} + + static void UpdateBroadcastWindowList(HWND hWnd) { int i; @@ -4526,6 +4541,10 @@ RECT rc_dlg, rc, rc_ok; POINT p; static int ok2right, cancel2right, cmdlist2ok, list2bottom, list2right; + // for update list + const int list_timer_id = 100; + const int list_timer_tick = 1000; // msec + static int prev_instances = 1; switch (msg) { case WM_SHOWWINDOW: @@ -4627,6 +4646,8 @@ list2bottom = p.y - rc.bottom; list2right = p.x - rc.right; + SetTimer(hWnd, list_timer_id, list_timer_tick, NULL); + return FALSE; case WM_COMMAND: @@ -4835,6 +4856,21 @@ } return TRUE; + case WM_TIMER: + { + int n; + + if (wp != list_timer_id) + break; + + n = GetApplicationInstanceCount(); + if (n != prev_instances) { + prev_instances = n; + UpdateBroadcastWindowList(BroadcastWindowList); + } + } + return TRUE; + default: return FALSE; }