[futurebasic] Re: [FB] Make an Alias?

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : July 1999 : Group Archive : Group : All Groups

From: GBeckman@...
Date: Mon, 12 Jul 1999 09:25:25 EDT
Sorry about the first send...a key press for another program seems to send in 
AOL.  Humph. 

In a message dated 7/12/99 3:20:15 AM, PRITCHA@... writes:

>How do you make an Alias of a file?


There are toolbox routines that will handle this for you , but I use PG 
routines and find them very solid.

One sets up like this:

    
    makeAlias=FN makeAlias(gSaveName$,gSaveVol,1003) Which is going to create 
an alias 1003 in resources using the save name and savevol.  


CLEAR LOCAL
DIM osErr
DIM RECORD fsSpec
  DIM fsVrefNum%
  DIM fsParID&
  DIM 63 fsName$
DIM END RECORD .fsSpec

DIM myFSSpec.fsSpec
DIM test
LOCAL FN SeeAboutAQuickOpen
  
  osErr=FN useAlias(1003,myFSSpec)


{I follow with this:}

  LONG IF osErr=0

    gFileVol=FN GetWDRefNum(myFSSpec.fsVrefNum%,myFSSpec.fsParID&,@OSErr)
   

{Because the  fsVrefNum% is not the saveVol that went in.   Rick Brown has 
some great articles an indeed much of this I am describing are Rick's 
routines.  So GetWDRefNum gets the Working Directory Reference Number, called 
gFileVol in PG.  It is the puppy you need for open and save routines.}

Here is getWDRefNum as per Rick.  _PGGP is my apps signature.

_myProcID = _"PGGP"
'-------------------------------------------------
CLEAR LOCAL
DIM iopb.52
DIM OSErr
LOCAL FN GetWDRefNum(volumeID, dirID&,OSErrAddr&)
  'Call as follows:
  '  wdRefNum = FN GetWDRefNum(volumeID, dirID&, @OSErr)
  'Returns a Working Directory Reference Number, given a
  '_true_ volume reference number (volumeID) and a directory
  'ID (dirID&).  The wdRefNum should be used in most places
  'where FB documentation talks about a "volume reference number".
  iopb.ioCompletion& = 0
  iopb.ioNamePtr& = 0
  iopb.ioVRefNum% = volumeID
  iopb.ioWDDirID& = dirID&
  iopb.ioWDProcID& = _myProcID
  OSErr = FN OPENWD(@iopb)
  POKE WORD OSErrAddr&, OSErr
END FN = iopb.ioVRefNum%

I will leave it there.  I anticipate that you may wish to have the alias set 
things up so that the next open or save will go to the alias and that is 
another whole kettle of worms.  I will be glad to share my humble 
understandings, if needed, on that subject.

George