I have a Windows Mobile application using the compact framework (NETCF) that I would like to respond to someone pressing the send key and have the phone dial the number selected in my application. Is there a way using the compact framework to trap the send key? I have looked at several articles on capturing keys, but I have not found one that includes the "Send" key.
Update:
I found an article describing SetWindowsHookEx as an undocumented API on Windows Mobile. If this is the case then I really don't want to use it.
SetWindowsHookEx on Windows Mobile
After doing more searching I found out that the "Send" key is called the "Talk" key in Windows Mobile lingo. I then found a blog post about using the SHCMBM_OVERRIDEKEY message to signal the OS to send my app a WM_HOTKEY message when the user presses the Talk key.
Jason Fuller Blog post about using the Talk button
The blog post and the documentation it points to seem like exactly what I'm looking for. I'm unable to find a working example, and I find a lot of people unable to make it work. It also looks like VK_TTALK is not supported in SmartPhones. I would love to hear from someone that actually has this working on both Smartphones and PocketPC phones.
Best Answer
I can confirm that using SHCMBM_OVERRIDEKEY works on both PPC and SP devices. I have tested it on WM5 PPC, WM5 SP, WM6 PPC, WM6 SP. I have not tried WM6.1 or WM6.5 yet but I kind-of assume that they work since WM6 works.
Also you may need to support DTMF during the call as well?
Since I was writing a LAP dll I followed the following page which you may find useful: LAP Implementation Issues
These examples are in C so you will have to translate them into C#.
To setup trapping of the "talk" key for a specific window you need to do:
You can turn on/off the trap at any time. To turn the trap off it easy as well:
To detect when the 'Talk' key is pressed you need to trap the WM_HOTKEY window message on the window proc:
To make a phone call you need to use the "PhoneMakeCall" API:
To support DTMF during a phone call you need to track the phone call using SNAPI (I believe there is a C# library to help you out there SystemProperty).
Setup after starting the call:
You will be called back with the window message you supply when the call count changes. You need to read the registry and check that the call count drops to zero. If it does you need to close the SNAPI handle:
While in the call send a message to the cprog application with the key that was pressed by the user: