Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!wuarchive!brutus.cs.uiuc.edu!apple!apple.COM!han From: han@apple.COM (Byron Han, Project Scapegoat) Newsgroups: comp.sys.mac.programmer Subject: Re: Interesting problem with GetResource('dctb', id) Message-ID: <5058@internal.Apple.COM> Date: 6 Nov 89 17:32:18 GMT References: <232@fwi.uva.nl> Sender: usenet@Apple.COM Organization: Apple Computer, Inc. - N&C Lines: 46 In article <232@fwi.uva.nl> dolf@fwi.uva.nl (Dolf Starreveld) writes: > I have written a general purpose "CopyResource" routine. The routine itself > was extensively tested and seemed to work, but ..... > The copying of the 'dctb' resource was only recently added and things > started to go wrong. After lots of debugging I found out that after executing > the following statement: > inHandle = GetResource('dctb', 10000); > "inHandle" contains a valid handle, but not a handle to a resource. I entered > TMON to find out more and: > 1) Just before executing the statement the 'dctb' resource is not > loaded in the heap. > 2) Just after the statement, the 'dctb' resource is loaded, but > immediately following it, the heap contains another relocatable > block of exactly the same size of the resource (48 bytes). > 3) The GetResource call returns a handle to this last block instead > of to the actually loaded resource. > > > > Is this a bug in the system software? Am I doing something wrong? > Any suggestions? Well, this is kind of a strange quirk in the operating system. Do this instead: SetResLoad(FALSE); hDCTB := GetResource('dctb', foobar); SetResLoad(TRUE); LoadResource(hDCTB); This should work in place of a simple GetResource. +-------------------------------------------------------------------------+ | Disclaimer: Apple has no connection with my postings. | +-------------------------------------------------------------------------+ Byron Han, CommToolbox Scapegoat "DeAnza 3 - R.I.P. - 10/17/89 5:04PM" Apple Computer, Inc. -------------------------------- 20525 Mariani Ave, MS 69L Internet: han@apple.COM Cupertino, CA 95014 UUCP:{sun,voder,nsc,decwrl}!apple!han -------------------------------- GENIE:BYRONHAN CompuServe:72167,1664 ATTnet: 408-974-6450 Applelink:HAN1 HAN1@applelink.apple.COM ---------------------------------------------------------------------------