Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!iuvax!uxc.cso.uiuc.edu!uxc.cso.uiuc.edu!ux1.cso.uiuc.edu!hoffman From: hoffman@ux1.cso.uiuc.edu Newsgroups: comp.sys.mac.programmer Subject: Re: Altering the Resouce fork Message-ID: <18300004@ux1.cso.uiuc.edu> Date: 27 Aug 89 20:04:00 GMT References: <1492@unocss.UUCP> Lines: 31 Nf-ID: #R:unocss.UUCP:1492:ux1.cso.uiuc.edu:18300004:000:1431 Nf-From: ux1.cso.uiuc.edu!hoffman Aug 27 15:04:00 1989 I've been doing that for years. I think I read somewhere that you should never change the resources of the running program, but I've NEVER had a problem. What I do is create a resource called PREF for my preferences. ID can be anything but I start at 0. I do a GetResource("PREF",0) and if NIL is returned then you create a default resource and write it. Then when you quit your program, call ChangedResource followed by WriteResource. You can find all of this in IM vol. 1 chapter 5. As for the data type of a PREF. It's whatever you want: myPrefHandle=^myPrefPtr; myPrefPtr=^myPrefRec; myPrefRec=RECORD .. your fields here .. end; (* record *) It's really a neat thing, but do some checking after GetResource in case someone has been poking around with ResEdit where they shouldn't. If you get back an invalid PREF, just go back to the default. Steve ___________________________________________________________________ | Steve M. Hoffman | email: hoffman@ux1.cso.uiuc.edu | | University of Illinois | internet: hoffman%ux1@uxc.cso.uiuc.edu | | Champaign/Urbana | uucp: uunet!uiucuxc!ux1!hoffman | |________________________| usmail: 515 Bach Ct. #24 | | I haven't a clue what | Champaign, IL 61820 | | I'm doing here | (217)/359-7448 | |________________________|________________________________________|