Hi I'm not able to load a Image.rsrc file at runtime and can't find
out how its done. The icns images and picts are usable in interface
builder. The executable resource fork contains the Image.rsrc, but
it just can't find it at runtime.
Oh and wasn't it fun trying to import a resource in IB using 'import
resource', when in fact, the resources have to be imported from the
XCode project IDE when IB launches - another great apple idea! :E
suggestions welcome
* posted via http://www.mymac.ws
* please report abuse to http://xinbox.com/mymac
Michael Dautermann - 25 Jun 2005 09:57 GMT
>Hi I'm not able to load a Image.rsrc file at runtime and can't find
>out how its done. The icns images and picts are usable in interface
>builder. The executable resource fork contains the Image.rsrc, but
>it just can't find it at runtime.
Resource files are still loadable in Carbon applications (that is,
I'm assuming you're using Carbon).
First thing you have to do is tell your application where the
resource file might be found.
CFBundleGetMainBundle() - gets the main application bundle
CFBundleCopyResourceDirectoryURL() -- returns the location of a bundle's
resource directory
CFURLGetFSRef() - to convert the resource directory URL into something
you can really use
FSGetCatalogInfo() - converts the FSRef into an FSSpec
FSpOpenResFile() - to open the res file
UseResFile() - finally, you can access your resources
I wonder if anybody has a more simple way to do this. :-)
Hope this information helps!

Signature
- myke @ umich.edu = Grad. Student Emeritus -
- mike @ mac.archive.umich.edu = MISTER archive -
- http://www-personal .umich .edu/~myke = my web page -
- Michael Dautermann... U-M Alumni calling in from way out there -
Chris Baum - 26 Jun 2005 05:33 GMT
> I wonder if anybody has a more simple way to do this.
It's 2005. Stop using .rsrc and switch to .icns and .png files?
omacdog - 28 Jun 2005 09:19 GMT
> CFBundleGetMainBundle() - gets the main application bundle
> CFBundleCopyResourceDirectoryURL() -- returns the location of a
> bundle's
> resource directory
> CFURLGetFSRef() - to convert the resource directory URL into something
> you can really use
> FSGetCatalogInfo() - converts the FSRef into an FSSpec
> FSpOpenResFile() - to open the res file
> UseResFile() - finally, you can access your resources
It's 2005. Stop using .rsrc and switch to .icns and .png files?
Thanks for the suggestions! I was expecting the executable to do a
default search in the apps resource fork to find resources. I should
have guessed that it wouldn't.
* posted via http://www.mymac.ws
* please report abuse to http://xinbox.com/mymac