DosQueryProcessInfo will return information about processes and tasks running in the system.
#define INCL_WPOS
#include <os2.h>
ULONG InfoType;
ULONG ID;
ULONG InfoLevel;
PVOID InfoBuffer;
PULONG InfoBufferLength;
PULONG InfoEntryCount;
APIRET ulrc; /* Return code. */
ulrc = DosQueryProcessInfo(InfoType, ID, InfoLevel,
InfoBuffer, InfoBufferLength, InfoEntryCount);