Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!rutgers!rochester!cornell!biar!trebor From: trebor@biar.UUCP (Robert J Woodhead) Newsgroups: comp.sys.mac.programmer Subject: Re: Purge or Revert Resource? Message-ID: <689@biar.UUCP> Date: 26 Jun 89 03:04:48 GMT References: <82203@ti-csl.csc.ti.com> Reply-To: trebor@biar.UUCP (Robert J Woodhead) Organization: Biar Games, Inc. Lines: 26 In article <82203@ti-csl.csc.ti.com> holland@m2.csc.ti.com (Fred Hollander) writes: >I want to revert a resource that is already loaded into memory by >reading the resource from the resource file and discarding any >changes. I also want to keep the same handle to the resource. Can >this be done? LoadResource won't do anything if it's already loaded. >I can't find a PurgeResource procedure. Is there any way to force a >resource to be purged or to force a resource to be reloaded? Check out DetachResource. Assuming H is a handle to a resource such as returned by GetResource, DetachResource(H) ``unlinks'' the handle so the resource manager no longer recognises it as a handle to a resource. So you can do something like this: DetachResource(H); DisposHandle(H); H:=GetResource('DERF',0); to do your reversion. I'm pretty sure that H will point to the same master pointer after the GetResource call. IM-I has some diagrams in the Resource Manager chapter that explain DetachResource quite well. -- (^;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-;^) Robert J Woodhead, Biar Games, Inc. !uunet!biar!trebor | trebor@biar.UUCP ``I can read your mind - right now, you're thinking I'm full of it...''