Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!bloom-beacon!usc!apple!apple.com!goldman From: goldman@apple.com (Phil Goldman) Newsgroups: comp.sys.mac.programmer Subject: Re: DA loses resource file on accRun Message-ID: <2932@internal.Apple.COM> Date: 20 Jul 89 08:38:43 GMT References: <1989Jul17.045641.20314@lth.se> Sender: usenet@Apple.COM Organization: Apple Computer Lines: 26 In article <1989Jul17.045641.20314@lth.se> sund@tde.lth.se (Lars Sundstr|m) writes: > I'm developing a desk accessory which reads a resource > file continuously. When the DA is running as a foreground > task it periodically receives accCursor events which > is used for reading a couple of resources. So far so good. > > However when running in the background the DA only receives > accRun events and the DA can't reach the resource file because > UseResFile(myResFile) gives ResError=-193 "resource file not found". > It seems to me that when the DA receives accRun events its called > without a context switching but I don't know for sure. > This is correct. The resource file was originally opened when the DA Handler was running. However, at accRun time some other app may be running, and that app has a different resource chain than DA Handler, so when the resource manager searches the current chain it never does find your map. The best workaround is to get the resources when you start up, or at some other time when you know that the app that opened you (usually DA Handler) is running. -Phil Goldman Apple Computer