Jump to content

SpGetPidList: Difference between revisions

From EDM2
No edit summary
Ak120 (talk | contribs)
 
(2 intermediate revisions by 2 users not shown)
Line 25: Line 25:
  END
  END


[[Category:The OS/2 API Project]]
[[Category:SpUtils]]

Latest revision as of 23:51, 6 March 2017

Retrieves a list of the process id's of all processes which module file names (full qualified) match against the given substring.

Syntax: success = spGetPidList ( stem [ , filter ] )

Parameters:

stem – The variable stem into which the list get stored.
filter – Substring of the filename of those processes which should be found.

Prepend a backslash to full filenames to prevent those processes which filenames contain filter as suffix from being found, e.g. XFILE.EXE and E.EXE.

Returns:

True (1) – At least one process identifier has been returned
False (0) – No process identifier has been returned

Example Code: (part of example code of spFilename from

/* ps.cmd (spUtils Example Code) */
/* List all currently active processes with pid and module name, */
/* optionally a filter substring can be passed as argument. */

CALL RXFUNCADD 'spLoadFuncs','spUtils','spLoadFuncs'
CALL spLoadFuncs

CALL spGetPidList 'p',ARG(1)
DO i=1 to p.0
     SAY RIGHT(p.i,5,' ') || ' ' || spFilenameFromPid(p.i)
END