Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!ames!ucsd!rutgers!apple!dwb From: dwb@Apple.COM (David W. Berry) Newsgroups: comp.sys.mac.programmer Subject: Re: VBL Tasks Message-ID: <25783@apple.Apple.COM> Date: 14 Feb 89 05:54:45 GMT References: <4398@hubcap.UUCP> <99000007@silver> <4418@hubcap.UUCP> Organization: Apple Computer Inc, Cupertino, CA Lines: 37 In article <4418@hubcap.UUCP> morourk@hubcap.UUCP (michael orourke) writes: >In article <99000007@silver>, sl161022@silver.bacs.indiana.edu writes: >> >> "VInstall and i understand about setting up a VBLTask record. However, what >> "if the procedure I install needs to be called only when a certain key combo >> "is hit? Does it have to scan the event queue or something? >> >> "I want it running all the time in the background. >> >> Actually, another way to do this (and the way I use to do a similar thing) >> is to install a patch for _GetOSEvent, which is called quite frequently. >> In fact, whenever the Finder, the running application, or any DA is ready >> to respond to an event, it will call either _GetNextEvent (which goes >> through the Toolbox Event Manager) or _GetOSEvent (which goes directly >> through the Operating System.) Since _GetNextEvent calls _GetOSEvent, >> you can patch _GetOSEvent and you'll be essentially guaranteed access >> to any keypress, and you can then do whatever you want. > >Sounds great. Only one problem. There followed after this response a lot of >assembly language code examples. But I don't know assembly language so I couldntmake heads or tail of what to do. > >How do I install a patch to a routine like GetOSEvent? By taking your life in your hands. Routines like GetOSEvent, GetNextEvent, etc should be patched only if absolutely necessary. In this case it isn't, Apple has thoughtfully provided a hook through which all events are filtered. What you want to do can be done by installing a pointer to a routine in jGNEFilter (0x????). For more details see Tech Note #85. > >Michael O'Rourke Opinions: MINE, ALL MINE! (greedy evil chuckle) David W. Berry (A/UX Toolbox Engineer) apple!dwb@sun.com dwb@apple.com 973-5168@408.MaBell