获取电话记录,phone.h

void GetPhoneNumberCallLog()
{
TCHAR LastIncomingCall[40];
TCHAR LastMissedCall[40];
TCHAR LastOutGoingCall[40];

TCHAR LastIncomingCallName[256];
TCHAR LastMissedCallName[256];
TCHAR LastOutGoingCallName[256];

HANDLE ph;
CALLLOGENTRY entry;
DWORD count;
entry.cbSize = sizeof(CALLLOGENTRY);
if(PhoneOpenCallLog(&ph)== S_OK)
{
   if(S_OK == PhoneSeekCallLog(ph, CALLLOGSEEK_BEGINNING, 0, &count))

//如果用CALLLOGSEEK_END那么count得到是的全部记录的个数

//如果用CALLLOGSEEK_BEGINNING那么count得是0
   {
    int lastIncallFlag = 0;
    int lastMissedCallFlag = 0;
    int lastOutgoingCallFlag = 0;

    while(PhoneGetCallLogEntry(ph, &entry) == S_OK)
    {
     if(( !lastIncallFlag)&&(entry.iom != IOM_OUTGOING) && (!entry.fOutgoing) )
     {
      //MessageBox(NULL, entry.pszNumber, TEXT("Last Incoming Call"), 0);
      lstrcpy(LastIncomingCall,   entry.pszNumber);
      if(!entry.pszName)
       lstrcpy(LastIncomingCallName,   TEXT("Unknow"));
      else
       lstrcpy(LastIncomingCallName,   entry.pszName);
      MessageBox(NULL,LastIncomingCall,LastIncomingCallName,0);
      lastIncallFlag = 1;
     }
     if(( !lastMissedCallFlag) && (entry.iom == IOM_MISSED))
     {
      lstrcpy(LastMissedCall,   entry.pszNumber);
      if(!entry.pszName)
       lstrcpy(LastMissedCallName,   TEXT("Unknow"));
      else
       lstrcpy(LastMissedCallName,   entry.pszName);
      MessageBox(NULL,LastMissedCall,LastMissedCallName,0);
      lastMissedCallFlag = 1;
     }
     if(( !lastOutgoingCallFlag) && (entry.iom == IOM_OUTGOING))
     {
      lstrcpy(LastOutGoingCall,   entry.pszNumber);
      if(!entry.pszName)
       lstrcpy(LastOutGoingCallName,   TEXT("Unknow"));
      else
       lstrcpy(LastOutGoingCallName,   entry.pszName);
      MessageBox(NULL,LastOutGoingCall,LastOutGoingCallName,0);
      lastOutgoingCallFlag = 1;
     }

     // Make phone
      /* PHONEMAKECALLINFO phonemakecall;
      phonemakecall.cbSize = sizeof(PHONEMAKECALLINFO);
      phonemakecall.dwFlags = PMCF_PROMPTBEFORECALLING;
      phonemakecall.pszDestAddress = entry.pszNumber;
      phonemakecall.pszAppName = NULL;
      phonemakecall.pszCalledParty = NULL;
      phonemakecall.pszComment = NULL;
      PhoneMakeCall(&phonemakecall);*/
    }

    //Show the call log filter
    //PhoneShowCallLog(CALLLOGFILTER_OUTGOING);
   }
}
PhoneCloseCallLog (ph);

}

打开phone.h发现在WM5.0上有两个两个函数在SDK里是没有的

第一个是

HRESULT PhoneAddSpeedDial(DWORD dwFlags, DWORD* piKey, const TCHAR* pszDisplayName, const TCHAR* pszTelNumber);

第二个是

HRESULT PhoneShowCallLog(CALLLOGFILTER iCallLogFilter);

typedef enum
{
     CALLLOGFILTER_ALL_CALLS,
     CALLLOGFILTER_MISSED,
     CALLLOGFILTER_INCOMING,
     CALLLOGFILTER_OUTGOING
} CALLLOGFILTER;

//++++++
//
//   PhoneAddSpeedDial
//
//        adds a speed dial entry
//
// dwFlags - currently unused, set to 0
//
// piKey - in/out: the key sequence which will invoke the speed dial.
//            currently an entry between 2 and 99 (inclusive) is valid.
//             the API will cause existing entries to be overwritten
//
// pszDisplayName - the non-empty display name for the speed dial
//
// pszTelNumber - the non-empty tel# to be dialed
//

HRESULT PhoneAddSpeedDial(DWORD dwFlags, DWORD* piKey, const TCHAR* pszDisplayName, const TCHAR* pszTelNumber);

 
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值