[futurebasic] Re: Launching an App from CODE resource.

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : December 1997 : Group Archive : Group : All Groups

From: Rick Brown <rbrown@...>
Date: Thu, 11 Dec 1997 19:01:27 -0600
WarMaster wrote:
> 
> I guess this has been gone over at least a hundred times by now, but:
> 
> If I have an fsSpec or a vRefNum to an application, is there a
> mini-runtime clean way to launch that app?

Yes.  If you have just a vRefNum, the first thing to do is to trade it
in for an FSSpec (using something like FN FSMakeFSSpec, which I can give
you a copy of if you don't already have it).  Once you've got an FSSpec
for the app, call FN SubLaunch below:

_myReserved1 = 0
_myReserved2 = 4
_mylaunchAppParameters = 40
'--------------------------------------------------------
LOCAL FN LaunchApplication(pbAddr&)
`     MOVE.L  ^pbAddr&,A0
`     DC.W    $A9F2
`     MOVE.W  D0,^OSErr
END FN = OSErr
'--------------------------------------------------------
LOCAL FN SubLaunch(AppSpecAddr&)
'Call as follows:
' OSErr = FN SubLaunch(@fsSpec)
'...where fsSpec is a 70-byte file spec record indicating the app.
DIM LaunchParams.44
LaunchParams.myReserved1& = 0
LaunchParams.myReserved2% = 0
LaunchParams.launchBlockID% = _extendedBlock
LaunchParams.launchEPBLength& = _extendedBlockLen
LaunchParams.launchControlFlags% = _launchNoFileFlags + _launchContinue
LaunchParams.launchAppSpec& = AppSpecAddr&
LaunchParams.mylaunchAppParameters& = _nil        '(sends default event)
OSErr = FN LaunchApplication(@LaunchParams)
END FN = OSErr

Hope this helps.
- Rick