GetFrontProcess
OSErr GetFrontProces (PSN); foreground process.
PSN is a pointer to the process serial number of the process running in
the foreground
noErr (0) No error
paramErr (-50) Process serial number is invalid
procNotFound (-600) No process in the foreground
Notes: You can use this function to determine if your process or some other
process is in the foreground. You can use the process serial number
result code procNotFound.