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:
SendMessage(SHFindMenuBar(window_hwnd),
SHCMBM_OVERRIDEKEY,
VK_TTALK,
MAKELPARAM((SHMBOF_NODEFAULT|SHMBOF_NOTIFY), (SHMBOF_NODEFAULT|SHMBOF_NOTIFY));
You can turn on/off the trap at any time. To turn the trap off it easy as well:
SendMessage(SHFindMenuBar(window_hwnd),
SHCMBM_OVERRIDEKEY,
VK_TTALK,
MAKELPARAM(0, (SHMBOF_NODEFAULT|SHMBOF_NOTIFY));
To detect when the 'Talk' key is pressed you need to trap the WM_HOTKEY window message on the window proc:
case WM_HOTKEY:
switch(HIWORD(lParam))
{
case VK_TTALK:
// make ph call
break;
}
return TRUE;
To make a phone call you need to use the "PhoneMakeCall" API:
#include <phone.h>
void MakePhoneCall(const wchar_t* number)
{
PHONEMAKECALLINFO call;
memset(&call, 0x0, sizeof(PHONEMAKECALLINFO));
call.cbSize = sizeof(PHONEMAKECALLINFO);
call.dwFlags = PMCF_DEFAULT;
call.pszDestAddress = number;
PhoneMakeCall(&call);
}
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:
#include <snapi.h>
RegistryNotifyWindow(SN_PHONEACTIVECALLCOUNT_ROOT, SN_PHONEACTIVECALLCOUNT_PATH, SN_PHONEACTIVECALLCOUNT_VALUE, window_hwnd, callback_window_msg_number /*e.g. WM_APP */, 0, NULL, &phone_call_notify_handle);
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:
RegistryCloseNotification(phone_call_notify_handle);
While in the call send a message to the cprog application with the key that was pressed by the user:
#define WM_CPROG_SEND_VKEY_DTMF (WM_APP+3) // Sends the DTMF tone(s) through to the current call (converting from VKEY to DTMF chars)
BOOL PhoneSendDTMF(UINT uvKey)
{
BOOL bRet = FALSE;
static HWND s_hwndCProg = NULL;
TCHAR chDTMF = MapVKeyToChar(uvKey);
// Attempt to find the cprog window (MSCprog).
// Try to keep this window handle cached.
if(NULL == s_hwndCProg || !IsWindow(s_hwndCProg))
{
s_hwndCProg = FindWindow(TEXT("MSCprog"), NULL);
}
// Send WM_CPROG_SEND_VKEY_DTMF to the CProg window.
if(NULL != s_hwndCProg)
{
bRet = BOOLIFY(PostMessage(s_hwndCProg,
WM_CPROG_SEND_VKEY_DTMF, (WPARAM)chDTMF, 0));
}
return bRet;
}