FB II Compiler

PG PRO

Debugging

Memory

System

Mathematics

Resources

Disk I/O

Windows

Controls

Menus

Mouse

Keyboard

Text

Fonts

Drawing

Sound

Clipboard

Printing

Communication

ASM

Made with FB

SYSTEM

Know the running applications


SYSTEM(_aplActive) is just a true/false flag that tells you the status of your _own_ process (i.e., whether it's in front or not), but doesn't tell you about other processes. I think the Toolbox functions "GetNextProcess" and "GetProcessInformation" will suit your needs: you can read about how they work in "Inside Macintosh:Processes". You can implement them in FB as follows:

'======================
LOCAL FN GetNextProcess(PSNptr&)
' --------------------------------
' Call as follows:
' OSErr = FN GetNextProcess(@PSN)
' (PSN should be an 8-byte record)
' --------------------------------
  ` CLR.W -(SP)
  ` MOVE.L ^PSNptr&,-(SP)
  ` MOVE.W #$0038,-(SP)
  ` DC.W $A88F
  ` MOVE.W (SP)+,^OSErr
END FN = OSErr
'=======================
LOCAL FN GetProcessInformation(@PSNptr&, infoPtr&)
' ------------- ' Call as follows:
' OSErr = FN GetProcessInformation(PSN, @ProcessInfo)
' PSN is an 8-byte record containing the Process Serial Number;
' ProcessInfo is a 60-byte record.
' -------------
  ` CLR.W -(SP)
  ` MOVE.L ^PSNptr&,-(SP)
  ` MOVE.L ^infoPtr&,-(SP)
  ` MOVE.W #$003A,-(SP)
  ` DC.W $A88F
  ` MOVE.W (SP)+,^OSErr
END FN = OSErr
'=======================

Rick