Path: utzoo!utgpu!watserv1!watmath!att!tut.cis.ohio-state.edu!pacific.mps.ohio-state.edu!zaphod.mps.ohio-state.edu!wuarchive!psuvax1!psuvm!uh2 From: UH2@psuvm.psu.edu (Lee Sailer) Newsgroups: comp.sys.amiga Subject: Re: How does SCRIPIT work? (How intercept IntuiMessages?) Message-ID: <90252.202734UH2@psuvm.psu.edu> Date: 10 Sep 90 00:27:34 GMT References: <33651@cup.portal.com> Organization: Penn State University Lines: 35 In article <33651@cup.portal.com>, Lee_Robert_Willis@cup.portal.com says: >I have a Amiga Guru question: I want to intercept the 'IntuiMessages' that >are passed from Intuition to an application (where the "application" is >any old pre-compiled Amiga program). I'm not a real guru, but I play one on TV... First, I recall that when SCRIPIT first showed, it came with source code, so that's one place you could look for inspiration. I've never even imagined being able to pull off what you ask, but basically I think the principles aren't too scary. When a program calls NewWindow(), Intuition sets up the window, including giving it a Message Port that Intuition can send messages too. I think your program could do a Forbid() to stop everything else from happening and then walk through the systems list of windows until it finds the one you want to manage. Assign its Message Port to one of your local variables, and then run at a higher priority than the target task. Your task should look through the incoming messages for ones it wants to delete, modify, or add new ones, and then WaitPort(). This will give the target task time to process some or all of the messages in the queue. If a new one arrives, your task will awaken before the receiver gets a chance to get it. I think the IntuiMessage itself contains the MsgPort to ReplyMsg() to. To intercept replies, your task would have to change that MsgPort to one of its own. I guess it must also save a copy of the original MsgPort. Then, it'll get the ReplyMsg()s, can do whatever it needs to do, and then change its reply port back to the oringinal and reply to it. Like I say. I've never done this, but it seems like one possible way to go at it. lee