home *** CD-ROM | disk | FTP | other *** search
- /* FindProcess.c
- * Find a process, and get information about it. From IM IV, p. 29-11
- * ©1992 Working Software, Inc.
- * This source code is copyrighted. Permission is granted to use the Word Services
- * portion of the Writeswell Jr. source code in your own programs, but you
- * may not distribute the Writeswell Jr. word-processor code as a
- * commercial product. If you modify the code, please do not call it
- * Writeswell Jr. (or Writeswell.) This will ensure that people understand the
- * program and don’t have to deal with a number of different versions with
- * who-knows-what going on in the code.
- *
- * Writeswell Jr. and Writeswell are trademarks of Working Software, Inc.
- * 22 Apr 92 Mike Crawford
- */
-
- #include <Processes.h>
- #include "FindProcess.h"
-
- Boolean FindAProcess( OSType signature,
- ProcessSerialNumber *psnPtr,
- ProcessInfoRec *pInfoPtr,
- FSSpecPtr fSpecPtr,
- StringPtr procName )
- {
- psnPtr->highLongOfPSN = 0;
- psnPtr->lowLongOfPSN = kNoProcess;
-
- pInfoPtr->processInfoLength = sizeof( ProcessInfoRec );
- pInfoPtr->processName = procName;
- pInfoPtr->processAppSpec = fSpecPtr;
-
- while( GetNextProcess( psnPtr ) == noErr ){
- if ( GetProcessInformation( psnPtr, pInfoPtr ) == noErr ){
- if ( pInfoPtr->processType == 'APPL' &&
- pInfoPtr->processSignature == signature ){
- return true;
- }
- }
- }
- return false;
- }