Get a TAPI Phone handle : use phoneInitializeEx()
I needed to get the TAPI Phone handle on Windows Mobile 6 to catch the signal (or event) of incoming voice call in my application. (I wanted to pause my own media player when I got called)
For the first step, I had to get the TAPI Phone handle using phoneInitializeEx() function, but it always return PHONEERR_INVALPARAM.
I found the solution. If you reached at the same problem of me, you should try this.
DWORD dwNumDevs = 0;
DWORD dwAPIVersion = TAPI_CURRENT_VERSION; // Important!!
PHONEINITIALIZEEXPARAMS oPhoneInitializeExParams = {0};
oPhoneInitializeExParams.dwTotalSize = sizeof(PHONEINITIALIZEEXPARAMS); // Important!!
oPhoneInitializeExParams.dwOptions = PHONEINITIALIZEEXOPTION_USEEVENT; // Important!!
LONG ret = phoneInitializeEx(&m_hPhoneApp, 0, 0, _T(”TAPIPhone”), &dwNumDevs, &dwAPIVersion, &oPhoneInitializeExParams);