Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.3 (USS@Tek, v1.0) based on 4.3bsd-beta 6/6/85; site tekcbi.UUCP Path: utzoo!linus!decvax!decwrl!pyramid!hplabs!tektronix!tekcbi!larryh From: larryh@tekcbi.UUCP (Larry Hutchinson) Newsgroups: net.sources.mac Subject: Quit To ... fragment. Is it correct? Message-ID: <522@tekcbi.UUCP> Date: Mon, 24-Feb-86 13:15:16 EST Article-I.D.: tekcbi.522 Posted: Mon Feb 24 13:15:16 1986 Date-Received: Wed, 26-Feb-86 07:28:05 EST Organization: Tektronix, Inc., Beaverton, OR Lines: 72 The following C fragment (module actually) is meant to be called from a Quit To ... menu item. It allows another program to be started up with out going to the Finder (like SkipFinder, but built in). I am posting it for two reasons: (1) I like programs that provide this feature and (2) I would like to know if it is correct. I know it works but don't know if it is the "proper" way of doing it. Responses should go to me or to net.micro.mac. The program is written in Aztec C and will need some modification for other dialects. [note: the \P generates a Pascal string and the keyword "Pascal" generates a routine that can be called from Pascal] Larry Hutchinson, Tektronix, Inc. PO Box 500, MS 02-305, Beaverton, OR 97077 { decvax,allegra }!tektronix!tekcbi!larryh -----------------cut here-------------------- /* launch.c * * defines launch() * allows user to start another program directly */ #include #include #include #include #include struct launchinfo { char *name; short code; }; static struct launchinfo lprog; pascal int makerun(itemNo,theDialog) /* makes open button say run */ int itemNo; /* this came from MacUser magazine */ DialogPtr theDialog; { int type; Handle item; Rect box; if(itemNo == -1){ GetDItem(theDialog,1,&type,&item,&box); SetCTitle((ControlHandle) item, "\PRun"); } return itemNo; } launch() /* run another program */ { SFReply repl; SFTypeList appltypes; appltypes[0]= 'APPL'; SFGetFile(100,100,0L,0L,1,appltypes,makerun,&repl); if(!repl.good) return(); lprog.name= repl.fName; lprog.code= 0; SetVol(0L,repl.vRefNum); /* this should work with HFS,no? */ #asm lea lprog_,a0 dc.w $a9f2 #endasm ExitToShell(); /* should never hapen */ }