var
h: THandle;
c:
Integer
;
data:
array
[
0
..
$ff
]
of
Char
;
l:
Integer
;
txt, clss:
String
;
begin
Memo1
.
Lines
.
Clear;
c:=
0
;
h:=GetTopWindow(GetDesktopWindow);
if
h<>
0
then
repeat
<font color="Red">
if
IsWindow(h)
and
IsWindowVisible(h)
and
not
IsIconic(h)
and
(GetParent(h)=
0
)
then
</font>
begin
Inc(c);
l:=GetWindowText(h, data,
$100
);
if
l>
0
then
txt:=Copy(data,
1
, l);
l:=GetClassName(h, data,
$100
);
if
l>
0
then
clss:=Copy(data,
1
, l);
Memo1
.
Lines
.
Add(IntToStr(h)+
' ['
+clss+
'] "'
+txt+
'"'
);
end
;
h:=GetNextWindow(h, GW_HWNDNEXT);
until
h=
0
;
Edit1
.
Text:=IntToStr(c);
end
;