IntroductionI've always resorted to using third party utilities for collecting the call history in my Windows Phone. But some one in the forums asked how to retrieve the call history. I finally took a look at this and it was much easier than I thought. The process is as simple as opening a handle to the call history, reading the call history, and then closing the handle. I put together the following code example for the user in the forums that had asked about it and thought to share it here. Code #include "stdafx.h"#include "phone.h"int _tmain(int argc, _TCHAR* argv[])
{
HANDLE callLogHandle;
CALLLOGENTRY logEntry;if(S_OK!=PhoneOpenCallLog(&callLogHandle))return -1;//failurelogEntry.cbSize = sizeof(CALLLOGENTRY);while(S_OK==PhoneGetCallLogEntry(callLogHandle, &logEntry))
{//The logEntry structure is populated with call data. //do something with it here.}
PhoneCloseCallLog (callLogHandle);return 0;
}Hopes help. |