Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!yale!mintaka!bloom-beacon!vaxeline!bootsie!olson From: olson@bootsie.uucp (Eric K. Olson) Newsgroups: comp.sys.mac.programmer Subject: Re: Is this possible with the Resource Manager? Message-ID: <1991Feb17.041728.11518@bootsie.uucp> Date: 17 Feb 91 04:17:28 GMT References: <1CE00001.ed5n0r@tbomb.ice.com> Organization: Lexington Software Design, Lexington, MA Lines: 40 In article <1CE00001.ed5n0r@tbomb.ice.com> time@ice.com writes: >How about: > SetResLoad(FALSE); > resHand = GetResource(type, id); > SetResLoad(TRUE); > if (*resHand!=NULL) { /* The resource was loaded */ > DetatchResource(resHand); > onDiskHand = GetResource(type, id); > DetachResource(onDiskHand); > /* Now move that resource back into place... */ > onDiskHand2 = GetResource(type, id); > SizeResource(onDiskHand2, GetHandleSize(resHand)); > BlockMove(*resHand, *onDiskHand2, GetHandleSize(resHand)); > ChangedResource(resHand); > } > >sound right? At first I thought this was a really good solution, but it doesn't do quite what my theoretical ReattachHandle() would. I don't understand the call to ChangedResource(resHand): wouldn't that just fail (it's no longer a Resource Handle)? If you meant ChangedResource(onDiskHand2), it doesn't reattach resHand. Any other old reference to the resource via resHand remains detached. New references via GetResource() return a different Handle (onDiskHand2). Calls to LoadResource() with the old Handle will fail. Please correct me if I'm wrong. My purpose for this is editting (or just copying) the currently running application's MENU resources. I don't need the changes to take effect until the next run (for editting). I _do_ need the resource as it appears on disk, even though it is in memory and not purgable (and modified from the data on the disk by the TCL). -Eric -- Eric K. Olson, Editor, Prepare() NOTE: olson@bootsie.uucp doesn't work Lexington Software Design Internet: olson@endor.harvard.edu 72A Lowell St., Lexington, MA 02173 Uucp: harvard!endor!olson (617) 863-9624 Bitnet: OLSON@HARVARD