//定義
function EnumThreadWndProc(hWnd,lParm :integer) : Boolean;stdcall;
procedure TForm1.Button1Click(Sender: TObject);
begin
//列挙開始
EnumThreadWindows(GetCurrentThreadId,@EnumThreadWndProc, 0)
end;
function EnumThreadWndProc(hWnd,lParm :integer) : Boolean;
Var
Name :array[0..MAX_PATH] of Char;
begin
If GetWindowText(hWnd, Name, MAX_PATH) <> 0 Then
Form1.ListBox1.Items.ADD(Name);
Result :=True;
end;
|