EnumWindows

EnumWindows

代码
function EnumWindowsFunc(Handle: THandle; List: TStrings):boolean; stdcall;
var
caption:
array[0..256] of Char;
begin
if GetWindowText(Handle, Caption, SizeOf(Caption)-1) <> 0 then
begin
List.Add(Caption) ;
//List.Add(IntToStr(Handle));
end;
result :
=True;
end;

procedure TMainForm.Button1Click(Sender: TObject);
begin
Memo1.Clear;
ListBox1.Clear;
EnumWindows(@EnumWindowsFunc, LParam(Memo1.Lines));
EnumWindows(@EnumWindowsFunc, LParam(ListBox1.Items));
end;

 

posted @ 2010-12-26 16:16  Jekhn  阅读(202)  评论(0编辑  收藏  举报