home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.sys.mac.programmer
- Path: sparky!uunet!paladin.american.edu!howland.reston.ans.net!sol.ctr.columbia.edu!sol.ctr.columbia.edu!mhall
- From: mhall@occs.cs.oberlin.edu (Matthew Hall)
- Subject: Re: Resources
- In-Reply-To: keith@taligent.com's message of Mon, 25 Jan 1993 01:50:12 GMT
- Followup-To: comp.sys.mac.programmer
- References: <rudolph.727824463@unixg.ubc.ca> <keith-240193173900@kip-50.taligent.com>
- Sender: nobody@ctr.columbia.edu
- Organization: Oberlin College Computer Science
- Date: Mon, 25 Jan 1993 13:40:51 GMT
- Message-ID: <MHALL.93Jan25084051@occs.cs.oberlin.edu>
- X-Posted-From: occs.cs.oberlin.edu
- NNTP-Posting-Host: sol.ctr.columbia.edu
- Lines: 60
-
- In article <keith-240193173900@kip-50.taligent.com> keith@taligent.com (Keith Rollin) writes:
-
- > In article <rudolph.727824463@unixg.ubc.ca>, rudolph@unixg.ubc.ca
- > (Christopher E Rudolph) wrote:
- > >
- > > Can anyone tell me if there is an quick way of opening an applications
- > > resource fork and then cycling through every resource in the application
- > > so that I can display them in a list.
- > >
- > > ie) simaler to what resource editors do
- > >
- > > I basically want to know what methods are available to read off every
- > > resource in an applications resource fork?
- > >
- >
- > The right way is to go back to Inside Mac IV and read the descriptions of
- > the functions Get1IndType, Get1IndResource, Count1Types and
- > Count1Resources. You would then write a function sort of like the
- > following:
- >
- > short numTypes, numResources, typeIndex, resIndex;
- > ResType type;
- > Handle resource;
- >
- > numTypes = Count1Types();
- > for (typeIndex = 1; numIndex <= numTypes; ++typeIndex)
- > {
- > Get1IndType(&type, typeIndex);
- > numResources = Count1Resources(type);
- > for (resIndex = 1; resIndex <= resTypes; ++resIndex)
- > {
- > resource = Get1IndResource(type, resIndex);
- > MessWithResource(resource);
- > }
- > }
-
- You will speed it up Much More, if you bracket this code with
- SetResLoad(FALSE)..SetResLoad(TRUE), since the resource manager will
- not read in the resource, but just it's name, number, and (size?),
- Thereby cutting down on possible disk access and memory useage. Of
- course, if you need to manipulate or read data from a resource, you
- will have to load it in by calling LoadResource, or if you saved the
- handle, GetResource.
- Just a note - be sure to call SetResLoad(TRUE) before doing anything
- that possibly might just perhaps use resources (such as manipulating a
- list, opening a window, jumping to a routine in another segment) since
- if these things have been purged or not loaded yet, they wont get
- loaded, and you may have a little mess on your hands.
-
- Hope this helps,
- -matt hall
-
-
- --
- -------------------------------------------------------------------------------
- Matt Hall. mhall@occs.oberlin.edu OR SMH9666@OBERLIN.BITNET
- (216)-775-6613 (That's a Cleveland Area code. Lucky Me)
-
- F(X)=M*X*(1-X)
-
-