GET PROCESS INFOEdit
GETPROCESSINFO index%, processName$ [PSN]
May, 2001 (Release 5)
A "Process" is something that is currently running on your computer; this includes, but is not limited to things like applications, control strip extensions, and background applications.
The index parameter in this call indicates which process is to be queried. An index value of -1 means that the front process is used. This is generally the running FB application that you created.
Index values of zero or higher represent running processes. You may climb this list, examining processes as you go, until the process name comes back as a null string. At that point, you have exhausted the system's list of processes and you can quit searching.
The process serial number is an 8 byte value (2 long integers) that holds a unique value which cannot be used by any other concurrent process. You create a process serial number as follows:
DIM psn AS ProcessSerialNumber
The following example shows how to display a list of running processes.
<b>DIM</b> indx& <b>DIM</b> ProcessName$ <b>DIM</b> psn as ProcessSerialNumber <code><b>GETPROCESSINFO</b> -1,ProcessName$ <b>PRINT</b> "My name is:""";ProcessName$;"""<br> <b>DEF TAB</b> 10 <b>PRINT</b> " indx","0x-------PSN------ ","Process Name"<br> indx& = 0 <b>DO</b> <b> GETPROCESSINFO</b> indx&,ProcessName$,psn <b>LONG IF</b> ProcessName$ <b>PRINT</b> indx&,"0x";<b>HEX$</b>(psn.highLongOfPSN); <b>PRINT HEX$</b>(psn.lowLongOfPSN),ProcessName$ <b>END IF</b> <b> INC</b>(indx&) <b>UNTIL LEN</b>(ProcessName$) == 0</code>
ON APPLEEVENT; APPLEEVENTMESSAGE$; KILL APPLEEVENT; SENDAPPLEEVENT