> >> From memory you create a code segment, attach it to your app > >> as a resource (Ben's answer to my question on how to do this > >> should be in the archive), load and lock it and then redirect the > >> trap through that code segment. > > > > Ugh. Why is that necessary? Can't you just use SysSetTrapAddress > > to intercept trap 0xA0A7 (sysTrapsysUIAppSwitch) with a function > > in your normal code segment? > > > Because (working from what I remember) your normal code segment > will be unloaded when your app exits. You need a chunk of code to > sit around disconnected from the normal Palm OS app startup and > shutdown.
Hmmm... I just found an application that pretty much does what I want (except that it intercepts only application launching and I want to intercept other things too) - and, from looking at the disassembly, it doesn't seem to be doing such stuff. Yup, it checks the OS version and registers a notification under PalmOS 5.x. Under the lower versions it just uses SysSetTrapAddress to point trap 0xA0A7 to a subroutine in its code segment. It also uses FtrSet to remember that it is intercepting something (because the interception can be turned off). But it doesn't have additional code segments or anything like that... In order to make sure that its code segment doesn't disappear, it locates it (CurAppDatabase, DmOpenDatabase, DmGetResource) and locks it (MemHandleLock) and protects the database where it resides (DmDatabaseProtect). Doesn't seem to do anything fancy and HackMaster-like, either. Perhaps this means that it might crash, but I don't have a second application that intercepts the same trap, so I can't test this. But the interception certainly works without problems after the user has switched to another application. OTOH, maybe I've missed something; I don't know 68k assembly language all that well. > If you were willing to release a code sample that > implements the hackmaster-independent mechanism as open source > I'd be happy to contribute some of my existing code to it. I just > don't have the time to turn that code into a sample and document > it. Unfortunately, the nature of the application I'm developing is such that it simply cannot be released as open source - although it most likely will be released as a free application (i.e., no payment required). I say "most likely" because, although I'm developing it during my free time, it belongs to the company I work for and the final decision is up to the boss. However, I've talked to him and he agrees that releasing it for free is the best thing to do - mostly because there won't be money in it worth the effort to collect them and because, if released for free, it will be a kind of advertisement for our main product. (If you google around for my name, you'll figure out what my main field of expertise is and what kind of application I'm likely to be writing.) Furthermore, I'm a bit opposed to the concept of the GNU license myself. I mean, if I release something like that, it would mean that anyone who uses any part of it in their application, has to release that application as open source too - and I find such a restriction unacceptable. However, I am perfectly willing to develop a sample demonsrating how to intercept things (i.e., not the actual application I'm writing) and release its source in the public domain (i.e., anyone is allowed to use it in any way they want). If such an agreement is OK with you, then perhaps we could do it? But that would mean that your contribution will have to be free (i.e., don't expect to sell it) and that I'll have to pester you with questions too (i.e., not just get a lump of code and try to figure on my own what to do with it). :-) Regards, Vesselin -- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/
