Path: utzoo!attcan!uunet!snorkelwacker!usc!brutus.cs.uiuc.edu!samsung!shadooby!netnews.engin.umich.edu!caen.engin.umich.edu!mystone From: mystone@caen.engin.umich.edu (Dean Yu) Newsgroups: comp.sys.mac.programmer Subject: Re: Tail patches Summary: Look, Ma! No tail patches! Message-ID: <46c51bee.129dc@blue.engin.umich.edu> Date: 11 Nov 89 10:13:00 GMT References: <1459@sequent.cs.qmc.ac.uk> <36250@apple.Apple.COM> <5056@internal.Apple.COM> <1989Nov7.212837.5146@oracle.com> <5080@internal.Apple.COM> <1467@sequent.cs.qmc.ac.uk> Reply-To: mystone@caen.engin.umich.edu Organization: Computer Aided Engineering Network, University of Michigan Lines: 41 Sender: Followup-To: In article <1467@sequent.cs.qmc.ac.uk> jeremyr@cs.qmc.ac.uk (Jeremy Roussak) writes: >>As for "sometimes you just gotta," all I can say is: don't do whatever it >>is you're doing that's "just gotta." Find a "more inventive" way. > >Since I initiated this thread, perhaps I could explain what I was doing, >and ask if anyone can suggest an alternative way of doing it. > >I was challenged to write a patch which would play a sound, preferably >whenever the Finder emptied the wastebasket (doesn't appear to be possible) >or at least when "Empty Wastebasket" was chosen from the menu. The >reason for this curious request was that the person concerned had changed >the wastebasket icon to look like a toilet and wanted it to flush! > >The obvious thing to do, (and we all do obvious things, don't we...) >was to do a tail patch on MenuSelect, look for a return of 0x00050002, >check that CurApName is the same as FinderName and to play the sound >if it is. I did it. It worked. It's not subtle, or particularly >clever, I confess. > >How should I have done this, without using a tail patch? > Install an event filter in jGNEFilter that looks for mouse ups. When you get a mouse up, and CurApName is FinderName, look at MenuDisable. If it's $00050002, then flush your toilet. (How's that for twisted?) Or, even better (depending on how you look at it) yet, patch _CopyBits. When the source and destionation rectangles are 32 by 32, do a bitwise compare with the stuffed trash can. (Or whatever your new icon is that signifies there's something in the trash.) If it's changing to the full state, set a flag in your code. Next time _CopyBits is called with source and destination rectangles of 32 by 32, and the bit map is the empty state of the trash can, play your sound here, then go on to the old _CopyBits. My, how the mind goes at 5:15 in the morning... _______________________________________________________________________________ Dean Yu | E-mail: mystone@caen.engin.umich.edu Self-declared License Czar | Real-mail: Dean Yu University of Michigan | 909 Church St Computer Aided Engineering Network | Apt C INCLUDE 'Disclaimers.a' | Ann Arbor, MI 48104 -------------------------------------------------------------------------------