Revision: 10291 https://osdn.net/projects/ttssh2/scm/svn/commits/10291 Author: zmatsuo Date: 2022-10-01 13:11:49 +0900 (Sat, 01 Oct 2022) Log Message: ----------- ウィンドウの角を丸くしない チェックボックスを無効にする条件を見直した - 修正前 - DwmSetWindowAttribute() API が存在しないとき - Vista より前で無効になっていた - 次の時に無効とする - DwmGetWindowAttribute() API が存在しないとき - または、DwmGetWindowAttribute(DWMWA_WINDOW_CORNER_PREFERENCE) の戻り値が S_OK 以外の時 - 角が丸くなるのは Windows 11 10.0.22000以降 Modified Paths: -------------- trunk/teraterm/common/compat_win.cpp trunk/teraterm/common/compat_win.h trunk/teraterm/teraterm/addsetting.cpp -------------- next part -------------- Modified: trunk/teraterm/common/compat_win.cpp =================================================================== --- trunk/teraterm/common/compat_win.cpp 2022-09-29 15:11:21 UTC (rev 10290) +++ trunk/teraterm/common/compat_win.cpp 2022-10-01 04:11:49 UTC (rev 10291) @@ -103,6 +103,7 @@ // dwmapi.dll HRESULT (WINAPI *pDwmSetWindowAttribute)(HWND hwnd, DWORD dwAttribute, LPCVOID pvAttribute, DWORD cbAttribute); +HRESULT (WINAPI *pDwmGetWindowAttribute)(HWND hwnd, DWORD dwAttribute, PVOID pvAttribute, DWORD cbAttribute); class Initializer { public: @@ -245,6 +246,7 @@ static const APIInfo Lists_dwmapi[] = { // Windows Vista or later { "DwmSetWindowAttribute", (void **)&pDwmSetWindowAttribute }, + { "DwmGetWindowAttribute", (void **)&pDwmGetWindowAttribute }, {}, }; Modified: trunk/teraterm/common/compat_win.h =================================================================== --- trunk/teraterm/common/compat_win.h 2022-09-29 15:11:21 UTC (rev 10290) +++ trunk/teraterm/common/compat_win.h 2022-10-01 04:11:49 UTC (rev 10291) @@ -70,8 +70,9 @@ #endif // 10.0.22000 or later +#if !defined(_DWMAPI_H_) +#define _DWMAPI_H_ #define DWMWA_WINDOW_CORNER_PREFERENCE 33 -#if !defined(DWM_WINDOW_CORNER_PREFERENCE) typedef enum { DWMWCP_DEFAULT = 0, DWMWCP_DONOTROUND = 1, @@ -210,6 +211,7 @@ // dwmapi.dll extern HRESULT (WINAPI *pDwmSetWindowAttribute)(HWND hwnd, DWORD dwAttribute, LPCVOID pvAttribute, DWORD cbAttribute); +extern HRESULT (WINAPI *pDwmGetWindowAttribute)(HWND hwnd, DWORD dwAttribute, PVOID pvAttribute, DWORD cbAttribute); void WinCompatInit(); Modified: trunk/teraterm/teraterm/addsetting.cpp =================================================================== --- trunk/teraterm/teraterm/addsetting.cpp 2022-09-29 15:11:21 UTC (rev 10290) +++ trunk/teraterm/teraterm/addsetting.cpp 2022-10-01 04:11:49 UTC (rev 10291) @@ -33,7 +33,7 @@ #include <stdio.h> #include <windows.h> #include <commctrl.h> -#include <time.h> +#include <dwmapi.h> #define _CRTDBG_MAP_ALLOC #include <stdlib.h> #include <crtdbg.h> @@ -790,9 +790,17 @@ SetCheck(IDC_CHECK_FAST_SIZE_MOVE, ts.EtermLookfeel.BGFastSizeMove != 0); SetCheck(IDC_CHECK_FLICKER_LESS_MOVE, ts.EtermLookfeel.BGNoCopyBits != 0); + // \x83E\x83B\x83\x93\x83h\x83E\x82̊p\x82\xF0\x8Aۂ\xAD\x82\xB5\x82Ȃ\xA2 SetCheck(IDC_CHECK_CORNERDONTROUND, (ts.WindowCornerDontround) != 0); - if (pDwmSetWindowAttribute == NULL) { - EnableDlgItem(IDC_CHECK_CORNERDONTROUND, FALSE); + { + DWM_WINDOW_CORNER_PREFERENCE preference; + if (pDwmGetWindowAttribute == NULL || + pDwmGetWindowAttribute(HVTWin, DWMWA_WINDOW_CORNER_PREFERENCE, &preference, sizeof(preference)) != S_OK) { + // \x83E\x83B\x83\x93\x83h\x83E\x82̊p\x82\xF0\x8Aۂ\xAD\x82\xB5\x82Ȃ\xA2\x82ɑΉ\x9E\x82\xB5\x82Ă\xA2\x82Ȃ\xA2\x82Ȃ\xE7 disable \x82ɂ\xB7\x82\xE9 + // DwmGetWindowAttribute() API \x82\xAA\x82Ȃ\xA2 or + // DwmGetWindowAttribute(DWMWA_WINDOW_CORNER_PREFERENCE) \x82\xC5 S_OK \x82\xAA\x95Ԃ\xE7\x82Ȃ\xA2 + EnableDlgItem(IDC_CHECK_CORNERDONTROUND, FALSE); + } } // \x83_\x83C\x83A\x83\x8D\x83O\x82Ƀt\x83H\x81[\x83J\x83X\x82Ă\xE9 @@ -1185,6 +1193,7 @@ ts.EtermLookfeel.BGFastSizeMove = GetCheck(IDC_CHECK_FAST_SIZE_MOVE); ts.EtermLookfeel.BGNoCopyBits = GetCheck(IDC_CHECK_FLICKER_LESS_MOVE); + // \x83E\x83B\x83\x93\x83h\x83E\x82̊p\x82\xF0\x8Aۂ\xAD\x82\xB5\x82Ȃ\xA2 if (ts.WindowCornerDontround != GetCheck(IDC_CHECK_CORNERDONTROUND)) { ts.WindowCornerDontround = GetCheck(IDC_CHECK_CORNERDONTROUND); if (pDwmSetWindowAttribute != NULL) {