Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!ncar!ames!oliveb!apple!darin From: darin@Apple.COM (Darin Adler) Newsgroups: comp.sys.mac.programmer Subject: Re: My problems with AddResource Message-ID: <1473@internal.Apple.COM> Date: 20 Apr 89 08:29:04 GMT References: <81471DN5@PSUVM> Organization: Apple Lines: 32 In article <81471DN5@PSUVM> DN5@PSUVM.BITNET writes: > I am trying to add a resource to a HyperCard stack. I have done this > successfully before, but I can't get it to work now. I copied the code > from my working version (which still works), but very odd things happen. > > My XCMD does the following: > > aMyRecHandle := MyRecHandle (NewHandle (SizeOf (MyRec))); > > AddResource (Handle (aMyRecHandle), 'Jfmt', 129, ''); > SetResAttrs (Handle (aMyRecHandle), resPurgeable); > UpdateResFile (CurResFile); > > ReleaseResource (Handle (aMyRecHandle)); > DisposHandle (Handle (aMyRecHandle)); The problem here is that you are calling SetResAttrs, which clears the resChanged bit in your resource. Quoting from Inside Mac Vol. I-122: "Warning: Do not use SetResAttrs to set the resChanged attribute; you must call ChangedResource instead. Be sure that the attrs parameter passed to SetResAttrs does not change the current setting of this attribute; to determine the current setting, first call GetResAttrs." You can use this instead: SetResAttrs(handle, BOR(GetResAttrs(handle), resPurgeable); -- Darin Adler, System Software Scapegoat, Apple Computer Internet: darin@Apple.com UUCP: {nsc,sun}!apple!darin