[Lazarus] Process ID

Michael Schnell mschnell at lumino.de
Thu Sep 13 10:11:35 CEST 2012


On 09/13/2012 07:36 AM, Kaj Mikkelsen wrote:
> If I understand your question correct, you are asking for a lazarus
> function.
> I don't think that exists.
> But you can use the TProcess to execute a linux command and grab the output.
>
IMHO its easier and more straight forward to do the functionality of 
"pidof" directly in pascal code:

  - do a loop with a findnext() to handle all directories within "/proc"
  - in each of them test if a file "cmdline" exists
  - read cmdline in a staring
  - if this denotes the process you mean to access the directory name is 
the PID

-Michael




More information about the Lazarus mailing list