Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Processing processes
#7
This also gets all descendants, ie children of children and so on. Not tested.

Macro Macro2757
Code:
Copy      Help
;gets all child/descendant processes of explorer

int pidParent=ProcessNameToId("explorer")
if(!pidParent) ret
ARRAY(int) a; int i
a[]=pidParent

__Handle hs=CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS 0)
PROCESSENTRY32 p.dwSize=sizeof(p)
Process32First(hs &p)
rep
,for i 0 a.len
,,if p.th32ParentProcessID=a[i]
,,,out F"pid={p.th32ProcessID}  name={&p.szExeFile%%s}"
,,,a[]=p.th32ProcessID
,if(!Process32Next(hs &p)) break

;int i
;for i 0 a.len
,;ShutDownProcess a[i] 1


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)