Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!apple!nerm From: nerm@Apple.COM (Dean Yu) Newsgroups: comp.sys.mac.programmer Subject: Re: PostHighLevelEvent from a completion routine? Message-ID: <54389@apple.Apple.COM> Date: 27 Jun 91 18:23:15 GMT References: <23852@shlump.lkg.dec.com> Organization: Apple Computer Inc., Cupertino, CA Lines: 28 In article <23852@shlump.lkg.dec.com> minow@ranger.enet.dec.com (Martin Minow) writes: >Since the body of the program runs in completion routines, I need a way to send >error status and logging information to the main application. However, when >I tried to use PostHighLevelEvent from a completion routine, the function >returned error -903 (noPortErr). This is not in the expected error list in >Inside Mac VI -- and PostHighLevelEvent is not specifically noted as >"can/can't call from completion routines." It sounds like your completion routine is getting called when another process which isn't high level event aware is in control, so you're working with that process' environment which doesn't include a PPC port, so you can't send HLEs. Also, according to my paperweight volume VI, _PostHighLevelEvent may move/ purge memory, so it really shouldn't be called from a completion routine. > >While I can fall back on using shared globals, I'm wondering if there >is any better way for a completion routine to send an "event" to >an application. > Since you're using PPC anyway, you can always use _PPCWrite to send a message back... -- Dean Yu Blue Meanie, Negative Ethnic Role Model, Window Cleaner, etc. Apple Computer, Inc. I've never used the PPC Toolbox in my life...