Как узнать какое окно закрывает форму

Материал из DRKB

Как узнать какое окно закрывает форму[править | править код]

// Find windows that may cover another window.
var
  hW: HWnd;
  r: TRect;
begin
  hw := Handle;
  while IsWindow(hw) do
  begin
    hw := GetWindow(hw, GW_HWNDPREV);
    if IsWindowVisible(hw) and not IsIconic(hw) then
    begin
      //... use GetWindowRect( hw, r ) to get candidate windows
      // rect and check if it intersects the forms BoundsRects via
      // IntersectRect
    end;
  end;
end;


ID: 00513