[Ttssh2-commit] [3455] NT4 で 32bit アイコンを表示しようとして崩れるので、Tera Term 同様 LR_VGACOLOR を指定するようにした。

Back to archive index

svnno****@sourc***** svnno****@sourc*****
2009年 6月 9日 (火) 01:25:42 JST


Revision: 3455
          http://svn.sourceforge.jp/view?root=ttssh2&view=rev&rev=3455
Author:   maya
Date:     2009-06-09 01:25:42 +0900 (Tue, 09 Jun 2009)

Log Message:
-----------
NT4 で 32bit アイコンを表示しようとして崩れるので、Tera Term 同様 LR_VGACOLOR を指定するようにした。

Modified Paths:
--------------
    trunk/ttpmenu/resource.h
    trunk/ttpmenu/ttpmenu.cpp
    trunk/ttpmenu/ttpmenu.rc


-------------- next part --------------
Modified: trunk/ttpmenu/resource.h
===================================================================
--- trunk/ttpmenu/resource.h	2009-06-08 15:55:59 UTC (rev 3454)
+++ trunk/ttpmenu/resource.h	2009-06-08 16:25:42 UTC (rev 3455)
@@ -44,6 +44,7 @@
 #define BUTTON_INITFILE                 1035
 #define EDIT_PROMPT_USER                1036
 #define STATIC_ICON                     1036
+#define IDC_TTPMENU_ICON                1036
 #define EDIT_PROMPT_PASS                1037
 #define CHECK_TTSSH                     1037
 #define EDIT_OPTION                     1038

Modified: trunk/ttpmenu/ttpmenu.cpp
===================================================================
--- trunk/ttpmenu/ttpmenu.cpp	2009-06-08 15:55:59 UTC (rev 3454)
+++ trunk/ttpmenu/ttpmenu.cpp	2009-06-08 16:25:42 UTC (rev 3455)
@@ -28,6 +28,7 @@
 HWND		g_hWndMenu = NULL;	// Ý’èƒ_ƒCƒAƒƒO‚̃nƒ“ƒhƒ‹
 HWND		g_hWndTip;			// Ý’èƒ_ƒCƒAƒƒO“àƒc[ƒ‹ƒ`ƒbƒv‚̃nƒ“ƒhƒ‹
 HICON		g_hIcon;			// ƒAƒvƒŠƒP[ƒVƒ‡ƒ“ƒAƒCƒRƒ“‚̃nƒ“ƒhƒ‹
+HICON		g_hIconSmall;		// ƒAƒvƒŠƒP[ƒVƒ‡ƒ“ƒAƒCƒRƒ“(16x16)‚̃nƒ“ƒhƒ‹
 HMENU		g_hMenu;			// ƒƒjƒ…[i”ñ•\Ž¦j‚̃nƒ“ƒhƒ‹
 HMENU		g_hSubMenu;			// ƒ|ƒbƒvƒAƒbƒvƒƒjƒ…[‚̃nƒ“ƒhƒ‹
 HMENU		g_hListMenu;		// Ý’èˆê——ƒ|ƒbƒvƒAƒbƒvƒƒjƒ…[‚̃nƒ“ƒhƒ‹
@@ -982,7 +983,7 @@
 	nid.uID					= TTERM_ICON;
 	nid.uFlags				= NIF_ICON | NIF_TIP | NIF_MESSAGE;
 	nid.uCallbackMessage	= WM_TMENU_NOTIFY;
-	nid.hIcon				= g_hIcon;
+	nid.hIcon				= g_hIconSmall;
 	lstrcpy(nid.szTip, "TeraTerm Menu");
 
 	::Shell_NotifyIcon(dwMessage, &nid);
@@ -2312,7 +2313,8 @@
 			::EndDialog(hWnd, FALSE);
 		}
 		SetDlgPos(hWnd, POSITION_CENTER);
-		::SetClassLong(hWnd, GCL_HICON, (LONG) g_hIcon);
+		PostMessage(hWnd, WM_SETICON, ICON_BIG, (LPARAM)g_hIcon);
+		PostMessage(hWnd, WM_SETICON, ICON_SMALL, (LPARAM)g_hIconSmall);
 		CreateTooltip();
 		crText		= ::GetSysColor(COLOR_WINDOWTEXT);
 		crBkgnd		= ::GetSysColor(COLOR_WINDOW);
@@ -2411,7 +2413,9 @@
 	switch(uMsg) {
 	case WM_INITDIALOG:
 		SetDlgPos(hWnd, POSITION_CENTER);
-		::SetClassLong(hWnd, GCL_HICON, (LONG) g_hIcon);
+		PostMessage(hWnd, WM_SETICON, ICON_BIG, (LPARAM)g_hIcon);
+		PostMessage(hWnd, WM_SETICON, ICON_SMALL, (LPARAM)g_hIconSmall);
+		SendDlgItemMessage(hWnd, IDC_TTPMENU_ICON, STM_SETICON, (WPARAM)g_hIcon, 0);
 		InitVersionDlg(hWnd);
 		return TRUE;
 	case WM_COMMAND:
@@ -2451,7 +2455,8 @@
 
 	switch(uMsg) {
 	case WM_CREATE:
-		::SetClassLong(hWnd, GCL_HICON, (LONG) g_hIcon);
+		PostMessage(hWnd, WM_SETICON, ICON_BIG, (LPARAM)g_hIcon);
+		PostMessage(hWnd, WM_SETICON, ICON_SMALL, (LPARAM)g_hIconSmall);
 		SetDlgPos(hWnd, POSITION_CENTER);
 		::ShowWindow(hWnd, SW_HIDE);
 		SetTaskTray(hWnd, NIM_ADD);
@@ -2576,6 +2581,7 @@
 	WNDCLASS	winClass;
 	char		uimsg[MAX_UIMSG];
 	DWORD		dwErr;
+	int			fuLoad = LR_DEFAULTCOLOR;
 
 	// ƒCƒ“ƒXƒg[ƒ‰‚ÅŽÀs‚ðŒŸo‚·‚邽‚ß‚É mutex ‚ðì¬‚·‚é (2006.8.12 maya)
 	// 2d‹N“®–hŽ~‚Ì‚½‚ß‚Å‚Í‚È‚¢‚̂ŁA“Á‚É•Ô‚è’l‚ÍŒ©‚È‚¢
@@ -2586,9 +2592,14 @@
 
 	GetUILanguageFile(UILanguageFile, sizeof(UILanguageFile));
 
-	g_hI	= hI;
-	g_hIcon	= ::LoadIcon(g_hI, (LPCSTR) TTERM_ICON);
+	g_hI			= hI;
 
+	if (is_NT4()){
+		fuLoad = LR_VGACOLOR;
+	}
+	g_hIcon			= (HICON)::LoadImage(g_hI, MAKEINTRESOURCE(TTERM_ICON), IMAGE_ICON, 32, 32, fuLoad);
+	g_hIconSmall	= (HICON)::LoadImage(g_hI, MAKEINTRESOURCE(TTERM_ICON), IMAGE_ICON, 16, 16, fuLoad);
+
 	memset(&winClass, 0, sizeof(winClass));
 	winClass.style			= (CS_BYTEALIGNCLIENT | CS_BYTEALIGNWINDOW | CS_DBLCLKS);
 	winClass.lpfnWndProc	= WinProc;

Modified: trunk/ttpmenu/ttpmenu.rc
===================================================================
--- trunk/ttpmenu/ttpmenu.rc	2009-06-08 15:55:59 UTC (rev 3454)
+++ trunk/ttpmenu/ttpmenu.rc	2009-06-08 16:25:42 UTC (rev 3455)
@@ -158,7 +158,7 @@
     DEFPUSHBUTTON   "OK",IDOK,61,69,44,14
     CTEXT           "Tera Term %s\r\nTeraTerm Menu Version %d.%02d",IDC_VERSION,20,9,124,19
     LTEXT           "Includes:\nversion 0.94r2\nCopyright(C) 1997-2003 S.Hayakawa\r\nCopyright(C) 2004-2007 TeraTerm Project",IDC_INCLUDE,13,31,150,35
-    ICON            TTERM_ICON,STATIC_ICON,4,8,21,20
+    ICON            "",IDC_TTPMENU_ICON,4,8,20,20
 END
 
 



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