Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!samsung!usc!zaphod.mps.ohio-state.edu!rpi!batcomputer!munnari.oz.au!bruce!trlluna!sandinista!sarcasm!summer From: summer@sarcasm.trl.oz.au (Mark Summerfield) Newsgroups: comp.sys.mac.programmer Subject: Problem with GetString? Or is it me? Message-ID: <1991Jan16.020012.24103@trl.oz.au> Date: 16 Jan 91 02:00:12 GMT Sender: news@trl.oz.au (USENET News System) Reply-To: m.summerfield@trl.oz.au Organization: Telecom Research Laboratories, Melbourne, Australia Lines: 38 In my latest project I am trying to do all the "right things", and am using 'STR ' resources for absolutely all text. In particular, my error alert code looks like this: void ErrorAlert(alrtID, strID) short alrtID, strID; { StringHandle theString; if ((theString = GetString(strID)) == nil) { /* Handle missing resource case... */ } HLock(theString); ParamText(*theString, nil, nil, nil); (void) CentreStopAlert(alrtID, nil); /* A function of mine that behaves exactly like StopAlert() except that at reads in the resource and centres the dialog on the screen before displaying it... works fine */ HUnlock(theString); /* Probably unnecessary */ DisposHandle(theString); } This works fine the first time I use it for any given strID, the problem is that if it is called a second time (at any later stage) with a strID that has been used before (ie if the same error occurs twice) then the handle returned by GetString() points to an empty string! I've checked this with SADE -- I'm not just guessing from the empty dialog box :-) What am I missing here? Please e-mail, our feed is still very poor. Thanks in advance, Mark. ------------------------------------------------+-----------------------------+ Mark Summerfield, Telecom Research Laboratories | Heisenberg may have | ACSnet[AARN/Internet]: m.summerfield@trl.oz[.au]| been here! | Snail: PO Box 249, Clayton, Vic., 3168 +-----------------------------+