[Ttssh2-commit] [6690] 通知アイコンを変更できるようにした。

Back to archive index

svnno****@sourc***** svnno****@sourc*****
2017年 4月 24日 (月) 20:49:50 JST


Revision: 6690
          http://sourceforge.jp/projects/ttssh2/scm/svn/commits/6690
Author:   doda
Date:     2017-04-24 20:49:49 +0900 (Mon, 24 Apr 2017)
Log Message:
-----------
通知アイコンを変更できるようにした。

Windows 2000 の時のみ VT Window を作成した時に 4bp のアイコンを登録するようにした。

Modified Paths:
--------------
    trunk/teraterm/common/ttcommon.h
    trunk/teraterm/teraterm/vtwin.cpp
    trunk/teraterm/ttpcmn/ttcmn.c
    trunk/teraterm/ttpcmn/ttpcmn.def

-------------- next part --------------
Modified: trunk/teraterm/common/ttcommon.h
===================================================================
--- trunk/teraterm/common/ttcommon.h	2017-04-24 11:49:47 UTC (rev 6689)
+++ trunk/teraterm/common/ttcommon.h	2017-04-24 11:49:49 UTC (rev 6690)
@@ -59,6 +59,7 @@
 void FAR PASCAL ShowNotifyIcon(PComVar cv);
 void FAR PASCAL HideNotifyIcon(PComVar cv);
 void FAR PASCAL SetVerNotifyIcon(PComVar cv, unsigned int ver);
+void FAR PASCAL SetCustomNotifyIcon(HICON icon);
 
 #define NotifyInfoMessage(cv, msg, title) NotifyMessage(cv, msg, title, 1)
 #define NotifyWarnMessage(cv, msg, title) NotifyMessage(cv, msg, title, 2)

Modified: trunk/teraterm/teraterm/vtwin.cpp
===================================================================
--- trunk/teraterm/teraterm/vtwin.cpp	2017-04-24 11:49:47 UTC (rev 6689)
+++ trunk/teraterm/teraterm/vtwin.cpp	2017-04-24 11:49:49 UTC (rev 6690)
@@ -845,6 +845,12 @@
 	                                MAKEINTRESOURCE((ts.VTIcon!=IdIconDefault)?ts.VTIcon:IDI_VT),
 	                                IMAGE_ICON, 0, 0, fuLoad));
 
+	SetCustomNotifyIcon(
+		(HICON)LoadImage(
+			AfxGetInstanceHandle(),
+			MAKEINTRESOURCE((ts.VTIcon!=IdIconDefault)?ts.VTIcon:IDI_VT),
+			IMAGE_ICON, 16, 16, LR_VGACOLOR|LR_SHARED));
+
 	MainMenu = NULL;
 	WinMenu = NULL;
 	if ((ts.HideTitle==0) && (ts.PopupMenu==0)) {

Modified: trunk/teraterm/ttpcmn/ttcmn.c
===================================================================
--- trunk/teraterm/ttpcmn/ttcmn.c	2017-04-24 11:49:47 UTC (rev 6689)
+++ trunk/teraterm/ttpcmn/ttcmn.c	2017-04-24 11:49:49 UTC (rev 6690)
@@ -2384,7 +2384,13 @@
 // Notify Icon \x8A֘A
 static NOTIFYICONDATA notify_icon = {0};
 static int NotifyIconShowCount = 0;
+static HICON CustomIcon = NULL;
 
+void FAR PASCAL SetCustomNotifyIcon(HICON icon)
+{
+	CustomIcon = icon;
+}
+
 void FAR PASCAL CreateNotifyIcon(PComVar cv)
 {
 	if (cv->NotifyIcon == NULL) {
@@ -2393,7 +2399,12 @@
 		notify_icon.uID = 1;
 		notify_icon.uFlags = NIF_ICON | NIF_MESSAGE;
 		notify_icon.uCallbackMessage = WM_USER_NOTIFYICON;
-		notify_icon.hIcon = (HICON)SendMessage(cv->HWin, WM_GETICON, ICON_SMALL, 0);
+		if (CustomIcon) {
+			notify_icon.hIcon = CustomIcon;
+		}
+		else {
+			notify_icon.hIcon = (HICON)SendMessage(cv->HWin, WM_GETICON, ICON_SMALL, 0);
+		}
 		notify_icon.szTip[0] = '\0';
 		notify_icon.dwState = 0;
 		notify_icon.dwStateMask = 0;

Modified: trunk/teraterm/ttpcmn/ttpcmn.def
===================================================================
--- trunk/teraterm/ttpcmn/ttpcmn.def	2017-04-24 11:49:47 UTC (rev 6689)
+++ trunk/teraterm/ttpcmn/ttpcmn.def	2017-04-24 11:49:49 UTC (rev 6690)
@@ -36,6 +36,7 @@
   HideNotifyIcon @81
   SetVerNotifyIcon @82
   NotifyMessage @79
+  SetCustomNotifyIcon @85
   
   SJIS2JIS @30
   SJIS2EUC @31



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