Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!samsung!umich!terminator!usenet From: rjc@css.itd.umich.edu (Robert John Churchill) Newsgroups: comp.sys.mac.programmer Subject: Need to be able to detect application start/finish Keywords: System 6 and System 7 / InitGraf / ExitToShell / CloseResFile Message-ID: <1991May20.173325.2527@terminator.cc.umich.edu> Date: 20 May 91 17:33:25 GMT Sender: usenet@terminator.cc.umich.edu (usenet news) Organization: Univ. of Michigan ITD Consulting & Support Services Lines: 42 I am writing an INIT that needs to notice whenever an application opens or closes (MultiFinder only). Currently, I've: * patched InitGraf to notice when an application opens... this works great for my needs. Of course, INITs can call InitGraf as well, but I'm also checking to see if the OSDispatch trap is around (indicating that MultiFinder calls I need are around) & so I only notice Applications (and, of course, DAs under System 7 when they open). * I've tried patching ExitToShell (at INIT time) but it seems that MultiFinder takes over this trap, and won't "pass it on". Should I give an attempt to patching ExitToShell at "InitGraf time"? * I've also tried patching out the "CloseResFile" trap to see when the give application's resource file is closed at exit time. This appears to work, and the refNum I'm picking off the stack appears correct, but I want to compare this to the low memory global CurApRefNum which appears NOT to be correct! Even though I could check for Apple Events, I don't want to as this would slow down the event process, and I need this to work for System 6 as well. Any thoughts on this matter would be greatly appreciated. Either post here, or e-mail me at: rjc@um.cc.umich.edu PS: In article 25136 of comp.sys.mac.programmer, Michael Dautermann writes: ... > Would somebody take a few seconds and look at this code and let me > know what I am doing wrong? Thanks so much for any help... Mike, come see me Monday, Wednesday, or Friday at my cube at Argus (yes, I'm Argus certified these days) and I can solve your problem for you. Let me know your e-mail address so I can keep messages local to us. :) Robert -- Robert_John_Churchill@um.cc.umich.edu University of Michigan ITD Consulting & Support Services Mac/Dos/Unix Consultant III, Programmer, and undergraduate PC2 archivist - mac.archive.umich.edu (141.211.168.70)