我需要检测特定窗口是否被最小化。为此,我发现了两个功能:
1.
function PAIsWindowMinimized(h: HWND): Boolean;
// Detects whether a window is minimized or not
var
wp: Winapi.Windows.WINDOWPLACEMENT;
begin
wp.length := SizeOf(Winapi.Windows.WINDOWPLACEMENT);
Winapi.Windows.GetWindowPlacement(h, @wp);
Result := wp.showCmd = Winapi.Windows.SW_SHOWMINIMIZED;
end;
2.
// Alternative (https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-isiconic):
Winapi.Windows.IsIconic(h);
两种选择中的哪一种更可取?还是它们在所有情况下都同样出色?