was ist neu ¦  programmier tips ¦  indy artikel ¦  intraweb artikel ¦  informationen ¦  links ¦  interviews
 sonstiges ¦  tutorials ¦  Add&Win Gewinnspiel

Tips (1541)

Dateien (137)
Datenbanken (90)
Drucken (35)
Grafik (114)
IDE (21)
Indy (5)
Internet / LAN (130)
IntraWeb (0)
Mathematik (76)
Multimedia (45)
Oberfläche (107)
Objekte/
ActiveX (51)

OpenTools API (3)
Sonstiges (126)
Strings (83)
System (266)
VCL (242)

Tips sortiert nach
Komponente


Tip suchen

Tip hinzufügen

Add&Win Gewinnspiel

Werbung

34 Visitors Online


 
...überprüfen, ob ein Control von einem anderen teilweise überdeckt wird?
Autor: Babak Sateli
Homepage: http://www.cdcenterco.com
[ Tip ausdrucken ]  

Tip Bewertung (7):  
     


{

  You would have to iterate over all windows above yours in Z-order and
  check for each window you find if it has the WS_EX_TOPMOST exstyle set
  and is visible.
  If it has, you have to get its window rectangle (GetWindowRect) and test
  if that overlaps your window.

  Example:

}

procedure TForm1.Button1Click(Sender: TObject);
var
  
wnd: HWND;

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

  procedure logWindowInfo(wnd: HWND);
  const
    
visString: array[Boolean] of string = ('not ', '');
  var
    
buffer: array[0..256] of Char;
    r:      TRect;
  begin
    if 
wnd = 0 then Exit;
    GetClassName(wnd, buffer, SizeOf(buffer));
    with Memo1.Lines do
    begin
      
Add(Format(' Window of class %s ', [buffer]));
      GetWindowRect(wnd, r);
      Add(Format(' at (%d,%d):(%d,%d)', [r.Left, r.Top, r.Right, r.Bottom]));
      Add(Format(' Window is %svisible', [visString[IsWindowVisible(wnd)]]));
      Add(Format(' Window is %stopmost', [visString[IsTopmost(wnd)]]));
    end;
  end;
  
begin
  
Memo1.Clear;
  wnd := Handle;
  repeat
    
wnd := GetNextWindow(wnd, GW_HWNDPREV);
    LogWindowInfo(wnd);
  until wnd = 0;
  Memo1.Lines.Add('End log.');
end;

 

Bewerten Sie diesen Tipp:

dürftig
ausgezeichnet


Copyright © by SwissDelphiCenter.ch
All trademarks are the sole property of their respective owners