Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!tut.cis.ohio-state.edu!pt.cs.cmu.edu!andrew.cmu.edu!ba0k+ From: ba0k+@andrew.cmu.edu (Brian Patrick Arnold) Newsgroups: comp.sys.mac.programmer Subject: Re: Launching with Document List Message-ID: Date: 6 Dec 89 23:59:11 GMT References: <1989Dec4.163228.8362@cs.swarthmore.edu> Organization: Mechanical Engineering, Carnegie Mellon, Pittsburgh, PA Lines: 62 In-Reply-To: <1989Dec4.163228.8362@cs.swarthmore.edu> Hello, Aaron Wohl once helped me with this problem. I get the feeling Apple may change its mind on how this works when System 7.0 arrives. You need tech notes #52 and #126 for details on (sub)launching. Right before sublaunching, you need to poke a handle into low memory: ----------------------------------- {Portions (c) 1986-1988 by Apple Computer, Inc. All rights reserved.} CONST { Location of Low Mem Global: handle to hold app parameters } { sort-of-documented in ToolEqu.asm MPW Assembly equate file } AppParmHandle = $AEC; TYPE { semi-documented finder info in launching an app with a file - MAY BREAK on future Systems - but explained in IM #2 Segment Loader } HApParms = ^PApParms; PApParms = ^RApParms; RApParms = RECORD printFlag : INTEGER; { use appOpen or appPrint constants from Segment Loader } numFiles : INTEGER; appFiles : ARRAY[1..1] OF AppFile; END; LongPtr = ^Handle; { hack to poke low memory global location } PROCEDURE SubLaunch; { launch an app with files as if from Finder } VAR MyAppParms : HApParms; AppParmLoc : LongPtr; fooVRefNum : INTEGER; BEGIN { don't ask - use SFGetFile or another means } fooVRefNum := MagicIncantationForGettingFileVRefNums( 'Foo' ); { Set appParms to launch and open files } myAppParms := HApParms( NewHandle( SIZEOF( RApParms ) ) ); WITH myAppParms^^ DO BEGIN printFlag := appOpen; numFiles := 1; appFiles[1].fName := 'Foo'; { my hack } appFiles[1].vRefNum := fooVRefNum; { you worry about this } appFiles[1].fType := 'TEXT'; { and this } appFiles[1].versNum := 0; END; { poke the low mem } AppParmLoc := LongPtr( AppParmHandle ); AppParmLoc^ := Handle( myAppParms ); { Do the launch as per TechNotes } END; ------------------------------------ People at Apple are encouraged to give UITP warnings as needed. - Brian