Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!mcnc!ecsvax!wmcb From: wmcb@ecsvax.UUCP (William C. Bauldry) Newsgroups: comp.sys.mac Subject: Re: How to launch an application Message-ID: <2950@ecsvax.UUCP> Date: Fri, 24-Apr-87 15:49:56 EST Article-I.D.: ecsvax.2950 Posted: Fri Apr 24 15:49:56 1987 Date-Received: Sat, 25-Apr-87 20:39:00 EST References: <1405@uwmacc.UUCP> <3326@linus.UUCP> <235@osupyr.UUCP> Reply-To: wmcb@ecsvax.UUCP (Bill Bauldry) Organization: UNC Educational Computing Service Lines: 74 Keywords: launch Here's a little routine to launch a program selected through the standard file package. (Done with LightSpeed Pascal - great product!) program launch; const Launch=$A9F2; { * trap word * } Var TopLeft: Point; PromptString : str255; FileFilter : ProcPtr; NumTypes : integer; TypeList : SFTypeList; DialogHook : ProcPtr; Reply : SFReply; myFile : Packed Record name: Ptr; buffers : integer; end; myFileHandle : Handle; registers = record a : array[0..4] of longint; d : array[0..7] of longint; end; Procedure CleanUp; begin { * Clean up current application's mess before the Launch * } end; begin { * Launch * } TopLeft.v := 75 { * where to put the dialog box * } TopLeft.h := 100; PromptString :=''; { * leftover from a previous system * } FileFilter := nil; NumTypes :=1; { * we're just interested in applications * } TypeList[0] := 'APPL'; DialogHook := nil; SFGetFile( TopLeft, PromptString, fileFilter, NumTypes, Typelist, DialogHook, Reply); If (Reply.good:=true) then { * a file was selected to run * } begin CleanUp; myFile.name := @Reply.FName; myFileBuffers :=0; { * 0 : launch with main screen & sound buffs * } { * + : main & alternate * } { * - : alt & alt * } registers.a[0] := longint(myFileHandle); Generic( Launch, registers ); end; { * good launch * } end. { * Launch * } We havew to use the Generic call since this routine (Launch) expects A0 to hold a pointer to the name followed by the code for the buffer e. Launch is register not stack based. i.e. Launch is a register, not stack, based routine. Next week the Launch done in Assembler will appear. ----------------------------------- Bill Bauldry Dept. of Math Sci Appalachian State U Boone, NC 28608 (wmcb@ecsvax.UUCP) allocations.