Path: utzoo!utgpu!water!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!bloom-beacon!mit-eddie!bbn!rochester!ur-tut!dpvc From: dpvc@ur-tut (Davide P. Cervone) Newsgroups: comp.sys.amiga.tech Subject: Re: Suggestion for 1.4 Message-ID: <2167@ur-tut.UUCP> Date: 16 Jun 88 18:02:12 GMT References: <611@myrias.UUCP> <62300005@hobbiton> <256@laic.UUCP> Reply-To: dpvc@tut.cc.rochester.edu.UUCP (Davide P. Cervone) Organization: Univ. of Rochester Computing Center Lines: 76 In article <256@laic.UUCP> darin@laic.UUCP (Darin Johnson) writes: >wIconify comes up with its own menus in the Workbench menubar. Does anyone >know how this was done? Yup. I wrote it. >Does it involve patching into the workbench image, Yuk! No! I may be desperate, but not that desperate! >or is there a simpler (undocumented or poorly documented) hook to do >this? The method used is simple, reasonably effective, and almost "safe". It's still illegal, so it's not really safe, and there are still things that can break it, but not many, and they would be illegel themselves. How does it work? Well, finding the WB menu strip is easy once you have the pointer to the WB window (which is not THAT hard to find). Once you have the menu strip, you can ClearMenuStrip(), chance the menu pointers (like add additional items), and SetMenuStrip() the monified menu. At his point, the new menu items appear when you hold down the menu button. That's the easy part. Now you have to intercept the MENUPICK events that the WB would get. This is the trick. To do it, you patch into the UserPort of the WB window. This isthe illegal part. Those of you who have seen my old MonIDCMP program, don't worry, I do NOT use that method of trapping IntuiMessages. I have a more robust method now that allows multiple evesdroppers on any message port. (I have a new version of MonIDCMP that uses it). I won;t go into the details of patching into the port here (I can send the new MonIDCMP code to anyone who is interested). The basic idea is to create a new port structure, and intertwine it with the WB port: link the head pointer of one to the tail pointer of the other. Messages posted to the one will actually arrive at the other. New messags sent to the WB port will not be available to the WB until after you read them from your new port and then re-post them to the port. This lets you "see" all the messages before WB gets them. You don't have to worry about priority and timing like the old MonIDCMP method. Once you have access to the WB IntuiMessage stream, all you have to do is look for MENUPICK events, and when you find one, look for the items that were chosen. If the item is one of your menus, then do what you have to do and remove it from the list of items chosen. Otherwise, pass it on to the WB. Note that you never REPLY to these messages, you simple read them from your port and re-post them as they are. When the WB replies to the message, it is returned to Intuition (not to you). I hope this gives someone some ideas of how to do this. it sounds like a neat approach to "pop-up" programs. I'd do it myself, but I'm already behind in my project list. >If so, I could write such a menu package, but without being able >to use workbench menus, it would be a kludge (such as having to click in >a mini window first - but then browser allows this sort of thing). Well, the approach I described is still a kludge, but it's a proven one (wIconify uses it). It's still illegal, though, and may break in a future release of Intuition. Provided that GetMsg and PutMsg check for end-of- message-list in the same way they do now, however, it should continue to work. >Darin Johnson (...pyramid.arpa!leadsv!laic!darin) > (...ucbvax!sun!sunncal!leadsv!laic!darin) I hope this was interesting to someone! Davide P. Cervone dpvc@tut.cc.rochester.edu dpvc@ur-tut.UUCP DPVC@UORDBV.BITNET P.S., I'm interested in how awful people think this kind of sneakiness is. Will you give up using wIcoinfy now that you know it "cheats"? Has anyone figured out how it gets rid of the windows yet?