@andcarne, on May 13 2006, 06:07 PM, said in Resource Editing in Mac OS Cocoa Objective-C:
Huh, somehow I totally managed to miss that in the reference documents.
Perhaps it's because it is at the end in miscellaneous functions (as are many functions added for CarbonLib and OSX), though it has been corrected in later versions of the reference documents.
@andcarne, on May 13 2006, 06:07 PM, said in Resource Editing in Mac OS Cocoa Objective-C:
Error codes are negative values, whereas a valid RefNum will be positive.
Doesn't surprise me that RefNums are positive, however there are valid, positive error codes (not just our fatal friends 1: bus error, 2: adress error, etc...) At any rate, but this is personal, I don't find it a good design.
@andcarne, on May 13 2006, 06:07 PM, said in Resource Editing in Mac OS Cocoa Objective-C:
The reason I used my value was because I was having trouble finding a MacRoman character table. It was easy enough just to have my app spew out a value for each resource type it found in the file, with the corresponding text representation (minus the characters with umlaüts over them).
Come on, just take just about any hex editor (including ResEdit's) and type the letter in the right column, and it will give you the hex value in the other. Quick and easy, works the other way too.
@andcarne, on May 13 2006, 06:07 PM, said in Resource Editing in Mac OS Cocoa Objective-C:
Oops, forgot to copy the ReleaseResource line over from my code. As for locking the handles, this project of mine has been a bit of a learning experience (my first from-scratch programming project, actually) and I have little knowledge of Handles. Thanks for the tip.
As long as you're running in OSX, you can get away with not locking handles since they are never moved anyway (wouldn't be of much use with the large address space and memory) to compact memory, though of course it is foolish to count on this as they can still be moved by SetHandleSize (because there may not be enough free memory after the memory block where it is right now, so it needs to be put in another place), and of course everything will explode on you as soon as you try backporting to OS9 (something that you should keep in mind when doing stuff to go with Nova: you might need to support OS9). Otherwise, not much to say about handles other than: don't fake them.