home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / sys / mac / programm / 22094 < prev    next >
Encoding:
Text File  |  1993-01-24  |  1.9 KB  |  58 lines

  1. Newsgroups: comp.sys.mac.programmer
  2. Path: sparky!uunet!cs.utexas.edu!sun-barr!ames!data.nas.nasa.gov!taligent!kip-50.taligent.com!user
  3. From: keith@taligent.com (Keith Rollin)
  4. Subject: Re: Resources
  5. Message-ID: <keith-240193173900@kip-50.taligent.com>
  6. Followup-To: comp.sys.mac.programmer
  7. Sender: usenet@taligent.com (More Bytes Than You Can Read)
  8. Organization: Taligent
  9. References: <rudolph.727824463@unixg.ubc.ca>
  10. Date: Mon, 25 Jan 1993 01:50:12 GMT
  11. Lines: 45
  12.  
  13. In article <rudolph.727824463@unixg.ubc.ca>, rudolph@unixg.ubc.ca
  14. (Christopher E Rudolph) wrote:
  15. > Can anyone tell me if there is an quick way of opening an applications
  16. > resource fork and then cycling through every resource in the application
  17. > so that I can display them in a list.
  18. > ie) simaler to what resource editors do
  19. > I basically want to know what methods are available to read off every
  20. > resource in an applications resource fork?
  21.  
  22. I can think of two ways. One is the right way, but I don't know if it meets
  23. your qualification of quick. The other way is definitely as quick as you'll
  24. get, but it is also definitely the wrong way.
  25.  
  26. The right way is to go back to Inside Mac IV and read the descriptions of
  27. the functions Get1IndType, Get1IndResource, Count1Types and
  28. Count1Resources. You would then write a function sort of like the
  29. following:
  30.  
  31. short numTypes, numResources, typeIndex, resIndex;
  32. ResType type;
  33. Handle resource;
  34.  
  35. numTypes = Count1Types();
  36. for (typeIndex = 1; numIndex <= numTypes; ++typeIndex)
  37. {
  38.     Get1IndType(&type, typeIndex);
  39.     numResources = Count1Resources(type);
  40.     for (resIndex = 1; resIndex <= resTypes; ++resIndex)
  41.     {
  42.         resource = Get1IndResource(type, resIndex);
  43.         MessWithResource(resource);
  44.     }
  45. }
  46.  
  47. I'm not going to tell you the wrong, fast way, but it too, amazingly, can
  48. be figured out by reading Inside Macintosh.
  49.  
  50. -----
  51. Keith Rollin
  52. Phantom Programmer
  53. Taligent, Inc.
  54.