rj0z+@andrew.cmu.edu (Robert George Johnston, Jr.) (10/18/88)
I am having a very hard time understanding why I cannot change a resource easily. Now, what am I doing wrong? I get a resource from a file: TheRes := GetResource(Type, ID); I use this resource for a while. And then allocate a new handle: NewRes := NewHandle(NewSize); I fill this handle with some data. Now, I want to replace the first resource with this new data. So, I tried: RmveResource(TheRes); DisposHandle(TheRes); AddResource(NewRes, Type, ID, Name); The call to AddResource is given the same Type, ID and Name of the original resource. AddResource returns NoErr. When I look in ResEdit, the resource data is invalid, and is usually huge. (GetInfo on the resource once told me that its size was approximately 1500K, but the file was only around 300 bytes.) Any help will be appreciated. Rob Johnston.
bob@eecs.nwu.edu (Bob Hablutzel) (10/19/88)
> I fill this handle with some data. Now, I want to replace the first > resource with this new data. So, I tried: > RmveResource(TheRes); > DisposHandle(TheRes); > AddResource(NewRes, Type, ID, Name); Have you tried updating the resource file after removing the old resource, and adding the new one? This might help... Of course it might not, too. Bob Hablutzel BOB@NUACC.ACNS.NWU.EDU