jdavid@pnet51.cts.com (Jon Davidson) (07/18/89)
Ok, My last plea for help must have been lost so here is my simple yet complex to me question. In a application i am writing I would like to include a "Launch other" menu choice. Well this is fine but I cannot figure out how to launch another application from within a application. I know how to Exittoshell but I would like to be able to run another application directly from my simple program. Can someone please inform me on how to go about doing this? I DO NOT want to d a Launch and return style lauch either becasue I want to return to the finder when the launched program is quitted. I am pretty sure it is with the _Launch macro but I cannot get the Lauchstruct info anywhere and I donot have all the volumes to inside mac either. PS: I would like the example in C format please. Thanks... ::::::::::::::::::::::::::::::::::::: :: Jon Davidson of Maple Grove, MN :: ::::::::::::::::::::::::::::::::::::::::::::::::::: :: :: :: + UUCP: rosevax!orbit!pnet51!jdavid :: :: + ARPA: crash!orbit!pnet51!jdavid@nosc.mil :: :: + INET: jdavid@pnet51.cts.com :: :: + Voice Mailbox: 612/438-6163 :: :: :: :::::::::::::::::::::::::::::::::::::::::::::::::::
kw1r+@andrew.cmu.edu (Kevin Whitley) (07/20/89)
Jon, If you happen to be using Lightspeed C, the easiest thing to do is to use their routine execl. You would use it as follows execl("volume:folder1:folder2:program"); and it goes. This has the disadvantage of needing a path, which is easy to hardcode, awkward to get out of the StdFileDialog. A more Mac approach (in LSC) is: DoLaunch() /* run a launch */ /* returns FALSE for cancelled dialog */ { SFReply launchFile; long tList; Point atWhere; ioParam volDat; SetPt(&atWhere,100,80); /* upper left corner of where dialog box will appear */ tList = 'APPL'; /* so dialog box lists applications */ SFGetFile(atWhere,0L,0L,1,&tList,0L,&launchFile); /* run dialog */ if (!launchFile.good) { /* user cancelled */ return(FALSE); } /* change volume (or working directory) to where application is */ volDat.ioCompletion = 0L; volDat.ioNamePtr = 0L; volDat.ioVRefNum = launchFile.vRefNum; PBSetVol(&volDat,FALSE); /* do the launch */ Launch(0,launchFile.fName); return(TRUE); /* shouldn't ever get here! */ } Kevin Whitley kw1r@andrew.cmu.edu