Forum Navigation
You need to log in to create posts and topics.

Re: Launching Applications / Making FSSpec Records

Posted by: microcsm <microcsm@...>

Jamin wrote:

>After much work I have found the cause of my Launching problems. It
>seems that on a PowerMac you MUST supply a valid ParentID in the FSSpec
>record within the Launch Paramater Block. Failure to do so will result
>in the strange behaviour I have mentioned. As to why this only affects
>native apps - I have no idea.
>
>So the moral of this story is, use FSMakeFSSpec instead of direct
>assignment eg:
>
>mySpec.fsName$ = "ApplicationName"
>mySpec.fsVRefNum% = SYSTEM(_AplVol)
>
>Thanks to all that took the time to send me example code

You should _never_ manually fill in an FSSpec record. That is what the
FSMakeFSSpec toolbox call is there for. And all FSSpec records should
have a parID - no exceptions that I know of to this. Your FSSpec may
work for what you are using it for now...but it will fail if you try it
on a file over a network. Use the FSMakeFSSpec call and you will always
be in the clear.

Do it like this instead:

'---------------------------------------
'FSMakeFSSpec
'---------------------------------------
LOCAL MODE
LOCAL FN FSMakeFSSpec(vRefNum%,dirID&,fileName$,@spec&)
` CLR.W -(SP)
` MOVE.W ^vRefNum%,-(SP) ;INTEGER
` MOVE.L ^dirID&,-(SP) ;LONGINT
` PEA ^fileName$ ;ConstStr255Param
` MOVE.L ^spec&,-(SP) ;Var: FSSpec
` DC.W $7001,$AA52
` MOVE.W (SP)+,D0
` EXT.L D0
END FN

DIM mySpec;0,vRefNum%,parID&,filename$;64
err = FN FSMakeFSSpec(SYSTEM(_AplVol),0,"ApplicationName",mySpec)

========================================
| David Blache - Developer |
========================================
| Staz Software, Inc - Stazologist |
| (tech@stazsoftware.com) |
| Microcosm Software, Inc. - Owner |
| (microcsm@goldinc.com) |
========================================