Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uwm.edu!linac!att!cbnewsm!cbnewsk!ech From: ech@cbnewsk.att.com (ned.horvath) Newsgroups: comp.sys.mac.programmer Subject: Re: When you AddResource, does the Handle now point to a resource? Message-ID: <1991Apr27.040313.26502@cbnewsk.att.com> Date: 27 Apr 91 04:03:13 GMT References: <1648@babcock.cerc.wvu.wvnet.edu> Organization: AT&T Bell Laboratories Lines: 32 From article <1648@babcock.cerc.wvu.wvnet.edu>, by vrm@blackwater.cerc.wvu.wvnet.edu (Vasile R. Montan): > I am writing a program which installs resources into files. Suppose > I have the following code: > > procedure InstallResource; > var > MyHandle : Handle; > begin > MyHandle^^ := {Whatever data to be put in the resource} > AddResource (MyHandle, rsrcType, rsrcID, rsrcName); > {...etc....} > end; > > As I understand it, I use DisposHandle to get rid of one of > my own handles, but I use ReleaseResource to get rid of a > resource. Assuming that I have written my code as above, > should I now say "DisposHandle(MyHandle)" or "ReleaseResource(MyHandle)"? > If I want to stop treating it as a resource, should I > DetachResource it, or is it already not a resource? > > If it is a resource, do I have to explicitly call UpdateResFile > (or WriteResource) before releasing it, or does calling ReleaseResource > automatically write it out? My habit is to wear suspenders, and belt, AND lead-lined undershorts just in case the first two fail. Yes, your handle is now a resource handle. Call WriteResource, and UpdateResFile. Then, you can DetachResource if you want your copy back. =Ned Horvath= ehorvath@attmail.com