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

48 Visitors Online


 
...eine Liste aller Internet Explorer Fenster bekommen?
Autor: Rm.
[ Tip ausdrucken ]  

Tip Bewertung (6):  
     


//I did it once for my friend, so I post it here.
//Create new app. and on main form add 1 button and 1 listview.

unit Unit1;

interface

uses
  
Windows, Messages, SysUtils, Classes, Graphics, Controls,
  Forms, Dialogs, StdCtrls, ComCtrls;

type
  
TForm1 = class(TForm)
    Button1: TButton;
    ListView1: TListView;
    Label1: TLabel;
    procedure Button1Click(Sender: TObject);
    procedure ListView1DblClick(Sender: TObject);
  private
    
{ Private declarations }
  
public
    
{ Public declarations }
  
end;

var
  
Form1: TForm1;

implementation

{$R *.DFM}


function GetText(WinHandle: THandle): string;
var 
  
P: array[0..256] of Char;
begin
  
P[0] := #0;
  GetWindowText(WinHandle, P, 255);
  if P[0] = #0 then Result := ''
  else 
    
Result := P;
end;

procedure TForm1.Button1Click(Sender: TObject);
var 
  
Hx: THandle;
  P: array[0..256] of Char;
  Item: TListItem;
begin
  
ListView1.Items.Clear;
  Hx := FindWindow(nilnil);
  GetClassName(Hx, P, SizeOf(P));
  if string(P) = 'IEFrame' then
  begin
    
Item := ListView1.Items.Add;
    Item.SubItems.Add(IntToStr(Hx));
    Item.Caption := GetText(Hx);
  end;
  while Hx <> 0 do
  begin
    
Hx := GetWindow(Hx, GW_HWNDNEXT);
    GetClassName(Hx, P, SizeOf(P));
    if string(P) = 'IEFrame' then
    begin
      
Item := ListView1.Items.Add;
      Item.SubItems.Add(IntToStr(Hx));
      Item.Caption := GetText(Hx);
    end;
  end;
end;

procedure TForm1.ListView1DblClick(Sender: TObject);
begin
  with 
(Sender as TListView) do
  begin
    if 
Selected <> nil then
    begin
      
PostMessage(StrToInt(Selected.SubItems[0]), WM_CLOSE, 0, 0);
      Selected.Delete;
    end;
  end;
end;

end.


 

Bewerten Sie diesen Tipp:

dürftig
ausgezeichnet


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