Getting device phone number using extended TAPI

The phone number of the mobile device can be retrieved using the API lineGetAddressCaps. The API fills the LINEADDRESSCAPS structure that is passed in with information about the address capabilities of the given line. The member dwAddressOffset represents the offset from the start of the structure to the line address. The syntax of the function is:

1 LONG WINAPI lineGetAddressCaps(HLINEAPP hLineApp,DWORD dwDeviceID,DWORD dwAddressID,DWORD dwAPIVersion,DWORD dwExtVersion,LPLINEADDRESSCAPS lpAddressCaps);

You can copy the string using the code:

1 WCHAR* pAddress = (WCHAR*)(((BYTE*)pAddressCaps) + pAddressCaps->dwAddressOffset);

This will give you the phone number of the device. You have to check whether the dwAddressOffset member is zero or not. If it is non zero then the system found a phone number.

posted @ 2016-03-02 11:33  91program  阅读(144)  评论(0编辑  收藏  举报