Path: utzoo!attcan!uunet!snorkelwacker!apple!voder!dtg.nsc.com!mcdan From: mcdan@dtg.nsc.com (Eric McDaniel) Newsgroups: comp.sys.mac.programmer Subject: Trap patch questions Message-ID: <1101@haydn.nsc.com> Date: 5 Jun 90 16:04:41 GMT Organization: National Semiconductor, Santa Clara Lines: 32 Reply-To: mcdan@dtg.nsc.com Distribution: I am trying to write a patch to display a dialog box under certain circumstances when an application is launched, and am having a few problems: 1. At first I tried patching the _Launch and _Chain traps, but some launching utilities (notably OnCue) apparently don't use these traps, as my code was not always executed. I now patch _LoadSeg and check if the segment number being loaded is #1 before calling my code. It works, but seems less efficient since _LoadSeg can be called any number of times within an application. Any suggestions? How do OnCue and similar utilities work? 2. When I call ShowWindow to display the dialog box, I consistently get some sort of system error. I checked the DialogPtr and all associated handles, and everything seems to be valid and on the system heap. I'm guessing the problem has something to do with setting up A5 or the GrafPort correctly. Could my use of a 'tail-patch' be the problem, and if so, how else could I write this thing? I'mm using Lightspeed C 3.01 on a Mac Plus, if that makes any difference.-- Eric McDaniel mcdan@dtg.nsc.com