读取手机通讯记录

来源:互联网 发布:如何删除kingroot软件 编辑:程序博客网 时间:2024/05/17 08:34
读取手机通讯记录
代码
  1.     //头文件和库
  2.     #include "phone.h"
  3.     #pragma comment(lib,"phone.lib")
  4. ////////////////////////////////////////////////////////////////////////////////////////////////////
  5.     HRESULT hr = S_OK;
  6.     HANDLE ph;
  7.     hr = PhoneOpenCallLog(&ph);//初始打开
  8.     CHR(hr);
  9.     DWORD count,pp;
  10.     hr = PhoneSeekCallLog(ph, CALLLOGSEEK_END, 0, &count);
  11.     CHR(hr);
  12.     for(int i = 0 ; i < (int)count ; i++)
  13.     {
  14.         hr = PhoneSeekCallLog(ph,CALLLOGSEEK_BEGINNING,i,&pp); 
  15.         CALLLOGENTRY pentry;
  16.         pentry.cbSize = sizeof(CALLLOGENTRY);
  17.         hr = PhoneGetCallLogEntry(ph,&pentry);
  18.         CE_CallLog_Info_Get cLog;
  19.         cLog.ftStartTime = pentry.ftStartTime;
  20.         cLog.ftEndTime = pentry.ftEndTime;
  21.         cLog.iom = pentry.iom;//0 IOM_MISSED,1 IOM_INCOMING,2 IOM_OUTGOING
  22.         cLog.fOutgoing = pentry.fOutgoing;// direction of call.  (Missed calls are incoming.)
  23.         cLog.fConnected = pentry.fConnected;// Did the call connect? (as opposed to busy, no answer)
  24.         cLog.fEnded = pentry.fEnded;// Was the call ended? (as opposed to dropped)
  25.         cLog.fRoam = pentry.fRoam;// Roaming (vs. local)
  26.         cLog.cidt = pentry.cidt;//0 CALLERIDTYPE_UNAVAILABLE,1 CALLERIDTYPE_BLOCKED,2 CALLERIDTYPE_AVAILABLE
  27.         cLog.pszNumber = pentry.pszNumber;
  28.         cLog.pszName = pentry.pszName;
  29.         cLog.pszNameType = pentry.pszNameType;// "w" for work tel, "h" for home tel, for example
  30.         cLog.pszNote = pentry.pszNote;// filename of associated Notes file
  31.     }
  32. Error:
  33.     PhoneCloseCallLog (ph);
 
 
原创粉丝点击