Path: utzoo!attcan!uunet!husc6!endor!siegel From: siegel@endor.harvard.edu (Rich Siegel) Newsgroups: comp.sys.mac.programmer Subject: Re: SFPGetFile Question Keywords: accessing vRefNum in dlgHook Message-ID: <937@husc6.harvard.edu> Date: 8 Jan 89 19:00:09 GMT References: <5959@polya.Stanford.EDU> Sender: news@husc6.harvard.edu Reply-To: siegel@endor.UUCP (Rich Siegel) Organization: Symantec/THINK Technologies, Bedford, MA Lines: 33 In article <5959@polya.Stanford.EDU> chao@polya.Stanford.EDU (Chih-Chao Lam) writes: >I am using my own dlgHook in a SFPGetFile call. I need to access the >vRefNum of the current file being selected in the Standard Open File >Dialog box. I know it's file name from sfReply.fname but >sfReply.vRefNum doesn't seem to be giving me the right information. When your dialog hook gets called the name and file type of the file selected are stuffed into the reply record. However, to get the vRefNum (or WDRefNum), you need to look at two low-memory globals: SFSaveDisk and CurDirStore. SFSaveDisk contains the NEGATIVE of the vRefNum of the volume being displayed, and CurDirStore contains the dirID of the directory being displayed. You can use these two values to open a working directory, if you need to. Another trick, to avoid opening WDs, is for each reply record, copy -SFSaveDisk into the first word of the reply record (normally occupied by "good" and "copy"), and copy CurDirStore into the longword occupied by "vRefNum" and "version". This will give other routines access to the same information as your hook. --Rich Rich Siegel Staff Software Developer THINK Technologies Division, Symantec Corp. Internet: siegel@endor.harvard.edu UUCP: ..harvard!endor!siegel Phone: (617) 275-4800 x305 Any opinions stated in this article do not necessarily reflect the views or policies of Symantec Corporation or its employees.