Palm API里没有公开的部分，Handspring Undocumented APIs
extern Err PhnLibActivate(UInt16 refNum, UInt16 line) PHN_LIB_TRAP (PhnLibTrapActivate);
So if you have ever developed for the Treos, you may have run into the fact that there are some functions that just aren’t available in the PhnLib SDK. One such function that I found missing the other day was a function to hang up a phone call that was already taking place.
So, as is my usual pattern, when I need to find something, I headed to Google groups, the Palm developer site and the PalmSource/Access developer web site. None of these turned up anything. Ugh. I started to get worried. Next, as is my usual custom, I headed to the header files to do some digging.
After poking around for a while in the headers, I found a tantalizingly named trap in HsPhoneTraps.h called ‘PhnLibTrapDisconnect’. For some strange reaon, the folks at Palm/Handspring neglected to include this function in the SDK, but included the system trap for it.
This was a fantastic find, and after a bit more poking and testing, I found some code that would work. Simply declare this function prototype somewhere in your headers:
extern Err PhnLibDisconnect(UInt16 refNum, UInt16 line) PHN_LIB_TRAP (PhnLibTrapDisconnect);
And then you will be free to disconnect whichever of the two lines you would like. One caveat that I would offer, however is that there may be additional variables required by this function so to be safe try calling the function like this:
Err err = PhnLibDisconnect(phnLibRef, 0);
As long as your compiler doesn’t optimize it away, the ‘char stackProtector’ right before you call the function should protect you just a bit from any stack issues that could arise from not having the right function signature.
Of course, you should use this snippet at your own risk, but I do sincerely hope that you find it useful. I certainly have. And as always, if you have additional info or comments about this, feel free to drop me a quick note. I always love good emails.