...determine whether a window is 'topmost' ?

Author: Thomas Stutz

Category: Forms

function IsWindowTopMost(hWindow: HWND): Boolean;
begin
  
Result := (GetWindowLong(hWindow, GWL_EXSTYLE) and WS_EX_TOPMOST) <> 0
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
  if 
isWindowTopMost(FindWindow('notepad', nil)) then
    
Label1.Caption := 'Window ist topmost'
  else
    
Label1.Caption := 'Window ist not topmost';
end;

 

printed from
www.swissdelphicenter.ch
developers knowledge base