I need to detect whether a specific window is minimized or not. For this purpose I have found two functions:
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://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-isiconic):
Winapi.Windows.IsIconic(h);
Which of the two alternatives is preferable? Or are they equally good in all situations?