[comp.sys.mac.programmer] Simple questions regarding MultiFinder and File Referencing

BRBOYER@MTUS5.BITNET (Bradley R. Boyer) (01/18/91)

I have just strted programming with great respect to MultiFinder.  There are
only a few things that I haven't figured out yet.

Q 1: How do I determine my current open directory by refnum?
     - Somehow while I running all over the disk, my output folder
       gets changed.  When I write my parameters back to disk, it is written
       to the wrong folder.  I would determine this value when I first run
       so I could keep track of it.

Q 2: How do I determine if Multifinder is running another program?
     - I could turn off my windows if I am not currently running.

            - Brad

  ------------------------
  |Bradley R. Boyer      |                     -----------------------------
  |BRBOYER @ MTUS5.BITNET|                     |"How could it have been me?|
  |Rucell @ MTU1.MERIT   |                     |    I wasn't even there!"  |
  ------------------------                     -----------------------------

mystone@mondo.engin.umich.edu (Dean Yu) (01/18/91)

In article <91048.134609BRBOYER@MTUS5.BITNET> BRBOYER@MTUS5.BITNET (Bradley R. Boyer) writes:
>I have just strted programming with great respect to MultiFinder.  There are
>only a few things that I haven't figured out yet.
>
>Q 1: How do I determine my current open directory by refnum?
>     - Somehow while I running all over the disk, my output folder
>       gets changed.  When I write my parameters back to disk, it is written
>       to the wrong folder.  I would determine this value when I first run
>       so I could keep track of it.

  When your application is first launched, the directory containing your
application (or the directory containing the documents you launched with) is
set to the default directory.  You can get the working directory reference
number with a call to _GetVol.

>Q 2: How do I determine if Multifinder is running another program?
>     - I could turn off my windows if I am not currently running.
>

  You can't tell if MultiFinder is running another program, per se, but you can
tell when you get switched into the background.  If you specify in your 'SIZE'
resource that you can accept suspend and resume events, MultiFinder will
send you an osEvent (formerly app4Events) when you get switched in and out.
You can hide your windows on this event.  You should check out the MultiFinder
Programmers' Guide for a more detailed description.  (The Process Manager
chapter in IM VI provides similar info for System 7.)

_______________________________________________________________________________
Dean Yu                            | E-mail:    mystone@mondo.engin.umich.edu
Patches 'R' Us                     | Real-mail: Dean Yu
A Division of Cyberite Systems     |            909 Church St Apt C
                                   |            Ann Arbor, MI 48104
I'm not the voice of Reason, much  | Phone:     313 662-4073
    less the voice of Cyberite.    |            313 662-4163
-------------------------------------------------------------------------------

lsr@Apple.com (Larry Rosenstein) (01/19/91)

In article <1991Jan17.220745.1621@engin.umich.edu>, mystone@mondo.engin.umich.edu (Dean Yu) writes:
> 
>   When your application is first launched, the directory containing your
> application (or the directory containing the documents you launched with) is
> set to the default directory.  You can get the working directory reference
> number with a call to _GetVol.

You should call GetVol at the very start of your program and save the
result away.  The reason is that some versions of TOPS (2.x at least) 
will change the current volume on you if a floppy disk is inserted.  I
think that TOPS call PBHGetVol/PBHSetVol internally, which is a no-no
according to Tech Note #140.

Alternatively, you can use PBHGetVol and use the dirID that it returns in
PBHOpen, for example.