[comp.sys.mac.programmer] simple init not working....

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

      Why doen't this INIT work?  It crashes when it gets to the
      SysBeep() call.

      pascal void myBeep(duration)
      int duration;
      {
	   Rect myRect;

	   SetRect(&myRect,0,0,512,342);
	   InvertRect(&myRect);
	   InvertRect(&myRect);
      }

      main()
      {
	   Handle myHandle;

	   myHandle = RecoverHandle((ProcPtr)myBeep);
	   HLock(myHandle);
	   NSetTrapAddress((ProcPtr)myBeep,0xA9C8,OSTrap);
	   SysBeep(8);

      }

      Other variations of this have gotten past the first SysBeep, inverting
the "startup" screen.  However, any further SysBeep call freezes the Mac.
Anyone know what's going (or not going) on?  Please reply to: sonenbli@oxy.edu
Thank ye, thank ye, thank ye, the turkey's in the mail.....