home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.sys.mac.programmer
- Path: sparky!uunet!cs.utexas.edu!sun-barr!ames!data.nas.nasa.gov!taligent!kip-50.taligent.com!user
- From: keith@taligent.com (Keith Rollin)
- Subject: Re: Resources
- Message-ID: <keith-240193173900@kip-50.taligent.com>
- Followup-To: comp.sys.mac.programmer
- Sender: usenet@taligent.com (More Bytes Than You Can Read)
- Organization: Taligent
- References: <rudolph.727824463@unixg.ubc.ca>
- Date: Mon, 25 Jan 1993 01:50:12 GMT
- Lines: 45
-
- 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?
- >
-
- I can think of two ways. One is the right way, but I don't know if it meets
- your qualification of quick. The other way is definitely as quick as you'll
- get, but it is also definitely the wrong way.
-
- 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);
- }
- }
-
- I'm not going to tell you the wrong, fast way, but it too, amazingly, can
- be figured out by reading Inside Macintosh.
-
- -----
- Keith Rollin
- Phantom Programmer
- Taligent, Inc.
-