home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!sun-barr!ames!agate!stanford.edu!rutgers!concert!duke!news.duke.edu!phy.duke.edu!mur
- From: mur@phy.duke.edu (Daniel Murphy)
- Newsgroups: comp.sys.mac.programmer
- Subject: changing resources
- Keywords: resources
- Message-ID: <4993@news.duke.edu>
- Date: 31 Aug 92 13:21:25 GMT
- Sender: news@news.duke.edu
- Distribution: usa
- Lines: 28
- Nntp-Posting-Host: physics.phy.duke.edu
-
-
- I am trying to update a resource from within my program, in particular
- I am trying to change a CNTL type resource's control value. This piece of
- code doesn't work,
-
- value=GetCtlValue((ControlHandle)control);
- SetCtlValue((ControlHandle)control,value);
- ChangedResource(control);
- WriteResource(control);
- while
- value=GetCtlValue((ControlHandle)control);
- SetCtlValue((ControlHandle)control,value);
- theHandle=Get1Resource('CNTL',128);
- memcpy(*theHandle + 8, &value, (size_t)2);
- ChangedResource(theHandle);
- WriteResource(theHandle);
-
- does. Here control and theHandle are both Handles to the same control
- resource. (Control was set using a GetDItem call.) Does control now point
- to the structure and theHandle to the actual resource? Obviously I'd rather
- avoid having to count bytes for every different type of resource in order to
- change it. Any advice would be appreciated.
-
- Dan Murphy.
- --
- Daniel Murphy 1-919-660-2522
- Duke University Dept. of Physics mur@phy.duke.edu
- Durham, N.C. 27706
-