procedure TForm1.Button2Click(Sender: TObject); var lppe: TProcessEntry32; found : boolean; Hand : THandle; P:DWORD; s:string; begin ListBox1.Items.Clear ; Hand := CreateToolhelp32Snapshot(TH32CS_SNAPALL,0); found := Process32First(Hand,lppe); while found do begin s := StrPas(lppe.szExeFile); if lppe.th32ProcessID>0 then p := lppe.th32ProcessID else p := 0; ListBox1.Items.AddObject(s,pointer(p));//列出所有进程。 found := Process32Next(Hand,lppe); end; end; 2