See, if this small piece of code can help you
Code:
function GetProcesses: integer;
var
i: integer; mib: array [0..2] of clt, len: clt; kp: pchr;
begin
/ / They say what you want to retrieve
mib[0] : = CTL_KERN; mib[1] : = KERN_PROC; mib[2] : = KERN_PROC_ALL;
/ / mib [3]: = 0;
len: = 0;
/ / first call "vacuum" gives the size of info available
if (sysctl.FPsysctl(pchr(@ eb), 3, nil, @ len, NIL, 0) <> -1) Then begin
if (len> 0) Then begin
kp StrAlloc =(len);
/ / The second call retrieves the information available
if (sysctl.FPsysctl(pchr(mib @), 3, kp, @ len, NIL, 0) <> -1) Then
begin
/ / kp Structure busy but how to find my children?
end; strdispose(kp);
end;
end;
end;
Bookmarks