sdh@thumper.bellcore.com (Retief of the CDT) (11/01/89)
Here's a puzzler. I have a program that loads a resource from itself, It it can't find one, it asks you if you want to load it from an external file. If so it gives a standard box to pick a file. On a reply.good, it tries to open the file with OpenResourceFile() ( I believe that's the call I may have mistyped it here), sending in the filename from the standard file routine. It fails and returns fnfErr (file not found) no matter what. So what's the deal? How do I get a resource file opened from a name selected from a standard file dialog? Replies by mail are preferred. Steve Hawley sdh@flash.bellcore.com
han@apple.COM (Byron Han, Project Scapegoat) (11/05/89)
In article <1765@thumper.bellcore.com> sdh@thumper.bellcore.com (Retief of the CDT) writes: > On a reply.good, > it tries to open the file with OpenResourceFile() ( I believe that's the > call I may have mistyped it here), sending in the filename from the > standard file routine. It fails and returns fnfErr (file not found) no > matter what. > > So what's the deal? How do I get a resource file opened from a name > selected from a standard file dialog? Well, you need to go the following (pseudo code) err := GetVol(@fooName, savedVRefNum); err := SetCol(NIL, theReply.vRefNum); newResourceFile := OpenResFile(theReply.fName); err := SetVol(NIL, savedVRefNum); This is do guarantee that you open the file from the proper working directory. SFxxxFile returns in theReply.vRefNum the working directory reference number of the folder. The WD refnum is an integer that specifies both a volume reference number and a directory ID. Hope this helps. +---------------------------------------------------------------------------+ | Disclaimer: Apple has no connection with my postings. | +---------------------------------------------------------------------------+ Byron Han, CommToolbox Scapegoat "DeAnza 3 - R.I.P. - 10/17/89 5:04PM" Apple Computer, Inc. ---------------------------------------- 20525 Mariani Ave, MS 69L Internet: han@apple.COM Cupertino, CA 95014 UUCP:{sun,voder,nsc,decwrl}!apple!han ---------------------------------- GENIE:BYRONHAN CompuServe:72167,1664 ATTnet: 408-974-6450 Applelink:HAN1 HAN1@applelink.apple.COM -----------------------------------------------------------------------------