[comp.sys.mac] Trouble with OpenResFile

oster@well.UUCP (David Phillip Oster) (10/06/87)

I've been reading the source for Andy Hertzfeld's program "Icon Bounce"
(published in _Programmers At Work_) and in it, he opens the desktop
file where the Finder caches all the icons, by doing the equivalent of
the LightSpeed C:
OpenResFile("\pDeskTop");
When I try this, I always get "File Not Found" error.  What is the secret
to make this work?
Did old versions of Icon Bounce stop working when HFS came out?
-- David Oster:  Arpa: oster@dewey.soe.berkeley.edu
UUCP: {ihnp4,decvax}!ucbvax!dewey.soe.berkeley.edu!oster

carlton@ji.Berkeley.EDU (Mike Carlton) (10/07/87)

I was bitten once by a bug that may be causing your problem.  It seems
that OpenResFile does a _RecoverHandle on the string you pass it.  Of
course, if you pass an explicit string like "\pDesktop" there is no
handle!  My solution was to create a handle, copy the string to it
and pass the dereferenced handle.  Pretty ugly, but it worked.

However, the code always crashed on me and did not return an error so
it may not be your problem.

Good luck,
mike (carlton@ji.berkeley.edu or ...!ucbvax!ji!carlton)

tedj@hpcilzb.HP.COM (Ted Johnson) (10/17/87)

I've never heard of the magazine "_Programmer's at Work_".  Where did
you get it?  Is it similiar to MacTutor?

	-Ted