Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!samsung!brutus.cs.uiuc.edu!apple!Apple.COM!lsr From: lsr@Apple.COM (Larry Rosenstein) Newsgroups: comp.sys.mac.programmer Subject: Re: How can I know if an application is already running? Message-ID: <5839@internal.Apple.COM> Date: 18 Dec 89 21:54:23 GMT Sender: usenet@Apple.COM Organization: Objects-R-Us, Apple Computer, Inc. Lines: 22 References:<8581@cs.yale.edu> <1042@maytag.waterloo.edu> In article <1042@maytag.waterloo.edu> jb@aries5.uucp (James Bruyn) writes: > by Apple, and won't work if somebody changes the application name - walk > through the FCB's looking for the file name. Or if you really want to > be picky, check creator and file type of every open file. It is probably better to call PBGetFInfo and check the value of ioFRefnum. Inside Mac volume 4 (p. 149) says this will be the reference number of the first access path found. If it's non-zero then the file is open. (Although I think on 64K ROMs, the system doesn't clear this if the file isn't open, so you should clear this field before making the call.) Also, the same call returns a set of flags in ioFlAttrib which indicate whether the resource and/or data fork is open (IM volume 4 p. 122). In ApplicationMenu is check for ioRefnum <> 0 to tell whether the DA Handler file is open, and therefore whether there is a DA layer. Larry Rosenstein, Apple Computer, Inc. Object Specialist Internet: lsr@Apple.com UUCP: {nsc, sun}!apple!lsr AppleLink: Rosenstein1