[comp.sys.mac.programmer] Help: 3, 2, 1, _Launch...

sonenbli@oxy.edu (Andrew D. Sonenblick) (10/27/89)

	   I've been bumbling around trying get this most simple of things to
      work: _Launching an application! However, no matter how I change things,
      (I've been through technotes, got samples from other people, etc) I
      always end up in Macsbug in the _Chain_ trap.  The most recent code
      I've tried is included.  If you could just take a look at it (it's
      short) and see what you see I'd think that would be about as cool as
      waking up one morning and seeing your 360MB HardDrive had a litter of
      about 5 30-40Meg HardDrives!  By the way, I am currently running
      Think C, 3.01.

      doTransfer()
      {
	   Point thePoint;
	   SFReply myReply;
	   int err;
	   SFTypeList myList;
	   typedef struct LaunchStruct {
		StringPtr     pfName;
		int	      param;
		char	      LC[2];
		long	      extBlockLen;
		int	      fFlags;
		long	      launchFlags
		}   *pLaunchStruct;

	   struct LaunchStruct myLaunch;
	   myList[0] = 'APPL';
	   myList[1] = '';
	   myList[2] = '';
	   myList[3] = '';
	   SetPt(&thePoint,70,70);
	   SFGetFile(thePoint,"\p",(Ptr)0,1,myList,(Ptr)0,&myReply);
	   if (!myReply.good)
		return;
	   SetVol(0,myReply.vRefNum);
	   myLaunch.pfName = (StringPtr)&myReply.fName;
	   myLaunch.param = 0;
	   myLaunch.LC[0] = 'L';
	   myLaunch.LC[1] = 'C';
	   myLaunch.extBlockLen = 6L;
	   myLaunch.fFlags = 0;
	   myLaunch.launchFlags = 0xC0000000;
	   if (0 > (err = LaunchCall(&myLaunch)))
		{report(err);
		return;
		}
      }

      pascal OSErr LaunchCall(LaunchPtr)
      {
	   asm{
	       Move.L	 (A7)+,A0
	       _Launch
	       Move.W	 D0,(A7)
	       }
      }


	   Well, folk, that's it.  I hope you see something you can help
      me with!	Thanks!  Ando Sonenblick: sonenbli@oxy.edu

      Special thanks to all those who answered my previous posting:  I got
yx      topics!!!!!  (Some we're quite entertaining, others very serious!)