[ttssh2-commit] [9932] _LoadIconWithScaleDown() の引数を WIN32API と同じに戻した

Back to archive index
scmno****@osdn***** scmno****@osdn*****
2022年 5月 18日 (水) 00:50:07 JST


Revision: 9932
          https://osdn.net/projects/ttssh2/scm/svn/commits/9932
Author:   zmatsuo
Date:     2022-05-18 00:50:07 +0900 (Wed, 18 May 2022)
Log Message:
-----------
_LoadIconWithScaleDown() の引数を WIN32API と同じに戻した

Modified Paths:
--------------
    branches/adjust_icon/teraterm/common/compat_win.cpp
    branches/adjust_icon/teraterm/common/compat_win.h
    branches/adjust_icon/teraterm/common/dlglib_cpp.cpp

-------------- next part --------------
Modified: branches/adjust_icon/teraterm/common/compat_win.cpp
===================================================================
--- branches/adjust_icon/teraterm/common/compat_win.cpp	2022-05-17 15:49:56 UTC (rev 9931)
+++ branches/adjust_icon/teraterm/common/compat_win.cpp	2022-05-17 15:50:07 UTC (rev 9932)
@@ -283,20 +283,6 @@
 	return false;
 }
 
-static bool IsWindows2000()
-{
-	OSVERSIONINFOA osvi;
-	osvi.dwOSVersionInfoSize = sizeof(osvi);
-	GetVersionExA(&osvi);
-	if (osvi.dwPlatformId == VER_PLATFORM_WIN32_NT &&
-		osvi.dwMajorVersion == 5 &&
-		osvi.dwMinorVersion == 0) {
-		// 2000
-		return true;
-	}
-	return false;
-}
-
 void WinCompatInit()
 {
 	static BOOL done = FALSE;
@@ -635,7 +621,7 @@
 	return S_OK;
 }
 
-HRESULT _LoadIconWithScaleDown(HINSTANCE hinst, PCWSTR pszName, int cx, int cy, HICON *phico, BOOL notify)
+HRESULT _LoadIconWithScaleDown(HINSTANCE hinst, PCWSTR pszName, int cx, int cy, HICON *phico)
 {
 	if (pLoadIconWithScaleDown != NULL) {
 		HRESULT hr = pLoadIconWithScaleDown(hinst, pszName, cx, cy, phico);
@@ -646,18 +632,10 @@
 
 	HICON hIcon;
 	int fuLoad = LR_DEFAULTCOLOR;
-	if (notify) {
-		// Windows 2000 \x82̃^\x83X\x83N\x83g\x83\x8C\x83C\x83A\x83C\x83R\x83\x93\x82\xCD 4bit \x83A\x83C\x83R\x83\x93\x82̂ݑΉ\x9E
-		if (IsWindows2000()) {
-			fuLoad = LR_VGACOLOR;
-		}
-	}
-	else {
+	if (IsWindowsNT4()) {
 		// Windows NT 4.0 \x82\xCD 4bit \x83A\x83C\x83R\x83\x93\x82\xB5\x82\xA9\x83T\x83|\x81[\x83g\x82\xB5\x82Ă\xA2\x82Ȃ\xA2
 		// 16(4bit) color = VGA color
-		if (IsWindowsNT4()) {
-			fuLoad = LR_VGACOLOR;
-		}
+		fuLoad = LR_VGACOLOR;
 	}
 	hIcon = (HICON)LoadImageW(hinst, pszName, IMAGE_ICON, cx, cy, fuLoad);
 	if (hIcon == NULL) {

Modified: branches/adjust_icon/teraterm/common/compat_win.h
===================================================================
--- branches/adjust_icon/teraterm/common/compat_win.h	2022-05-17 15:49:56 UTC (rev 9931)
+++ branches/adjust_icon/teraterm/common/compat_win.h	2022-05-17 15:50:07 UTC (rev 9932)
@@ -195,7 +195,7 @@
 HRESULT _SHGetKnownFolderPath(REFKNOWNFOLDERID rfid, DWORD dwFlags, HANDLE hToken, PWSTR* ppszPath);
 
 // comctl32.dll
-HRESULT _LoadIconWithScaleDown(HINSTANCE hinst, PCWSTR pszName, int cx, int cy, HICON *phico, BOOL notify);
+HRESULT _LoadIconWithScaleDown(HINSTANCE hinst, PCWSTR pszName, int cx, int cy, HICON *phico);
 
 
 void WinCompatInit();

Modified: branches/adjust_icon/teraterm/common/dlglib_cpp.cpp
===================================================================
--- branches/adjust_icon/teraterm/common/dlglib_cpp.cpp	2022-05-17 15:49:56 UTC (rev 9931)
+++ branches/adjust_icon/teraterm/common/dlglib_cpp.cpp	2022-05-17 15:50:07 UTC (rev 9932)
@@ -361,10 +361,21 @@
 		cy = cy * dpi / 96;
 	}
 	HICON hIcon;
-	HRESULT hr = _LoadIconWithScaleDown(hinst, name, cx, cy, &hIcon, notify);
-	if(FAILED(hr)) {
-		hIcon = NULL;
+	if (IsWindowsNT4() || (notify && IsWindows2000())) {
+		// 4bit \x83A\x83C\x83R\x83\x93
+		// 		1. NT4 \x82̂Ƃ\xAB
+		//				Windows NT 4.0 \x82\xCD 4bit \x83A\x83C\x83R\x83\x93\x82\xB5\x82\xA9\x83T\x83|\x81[\x83g\x82\xB5\x82Ă\xA2\x82Ȃ\xA2
+		// 		2. Windows 2000 \x82̃^\x83X\x83N\x83g\x83\x8C\x83C\x83A\x83C\x83R\x83\x93\x82̂Ƃ\xAB
+		//				Windows 2000 \x82̃^\x83X\x83N\x83g\x83\x8C\x83C\x82\xCD 4bit \x83A\x83C\x83R\x83\x93\x82\xB5\x82\xA9\x83T\x83|\x81[\x83g\x82\xB5\x82Ă\xA2\x82Ȃ\xA2
+		// LR_VGACOLOR = 16(4bit) color = VGA color
+		hIcon = (HICON)LoadImageW(hinst, name, IMAGE_ICON, cx, cy, LR_VGACOLOR);
 	}
+	else {
+		HRESULT hr = _LoadIconWithScaleDown(hinst, name, cx, cy, &hIcon);
+		if(FAILED(hr)) {
+			hIcon = NULL;
+		}
+	}
 	return hIcon;
 }
 


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