unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 =
class(TForm)
ListBox1: TListBox;
Button1: TButton;
procedure Button1Click(Sender: TObject);
function EnumWindowsProc(wHandle: HWND; lb: TListBox): Bool;
stdcall;
export;
private
{ Private-Deklarationen }
public
{ Public-Deklarationen }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
EnumWindows(@EnumWindowsProc, Integer(ListBox1));
end;
function TForm1.EnumWindowsProc(wHandle: HWND; lb: TListBox): Bool;
stdcall;
export;
var
Title, ClassName:
array[0..255]
of char;
begin
Result := True;
GetWindowText(wHandle, Title, 255);
GetClassName(wHandle, ClassName, 255);
if IsWindowVisible(wHandle)
then
lb.Items.Add(
string(Title) + '
-' +
string(ClassName));
end;
end.