//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(nil, nil);
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.