locked
Detecting a missed call - Windows Mobile Standard 6 RRS feed

  • Question

  • Hi

    I'm using the following code:

    HKEY hKey;
    DWORD dwCalls = 0;
    DWORD dwSize = sizeof(DWORD);
    
    if (RegOpenKeyEx(HKEY_CURRENT_USER, TEXT("System\\State\\Phone"), 0, KEY_READ, &hKey) == ERROR_SUCCESS)
    {
    	RegQueryValueEx(hKey, TEXT("Missed Call Count"), NULL, NULL, (LPBYTE) dwCalls, &dwSize);
    	RegCloseKey(hKey);
    }
    
    But it's not working. I devised this from information I found in the SDK documentation, not sure if it is correct, but it's not detecting anything ever. I only want to detect new missed calls, not calls that have been read in the call log.

    I've tried accessing the call log and checking for IOM_MISSED, but it doesn't appear there's a way to check whether it's been read.

    Any ideas?

    Regards

    Lionel
    "The moon could not continue shining if it had to pay attention to all the dogs barking at it."
    Thursday, July 16, 2009 12:32 PM

Answers

  • Hi,

    Try like the following. It works for me...
    void MissedcallCallBack(HREGNOTIFY hNotify, DWORD dwUserData, const PBYTE pData, const UINT cbData)
    {
    printf("You have missed call");
    }
    
    void registerMissedcall()
    {
    HREGNOTIFY hNotify;
     
    REGISTRYNOTIFYCALLBACK regCallBack = MissedcallCallBack;
    RegistryNotifyCallback(SN_PHONEMISSEDCALLS_ROOT, SN_PHONEMISSEDCALLS_PATH, SN_PHONEMISSEDCALLS_VALUE, regCallBack, 0, NULL, &hNotify));
    
    }

    Azad.S
    • Marked as answer by Y-Lionel Thursday, July 16, 2009 2:16 PM
    Thursday, July 16, 2009 1:20 PM

All replies

  • Hi Lionel,

    if a missed call has been "read" it doesn't has the IOM_MISSED state anymore. So looking for IOM_MISSED calls is the right way to get them. If you want to get notified for missed calls then use the State and Notifications Broker API. You can then listen for changes to SN_PHONEMISSEDCALLS_PATH by checking SN_PHONEMISSEDCALLS_VALUE.

    Regards,
    Chris
    • Proposed as answer by installer09 Friday, July 17, 2009 10:37 AM
    Thursday, July 16, 2009 12:49 PM
  • Hi

    Thanks,

    I'm trying this but it returns all the missed calls as IOM_MISSED, even after opening the missed calls item on the home screen and viewing the missed calls (also viewed them from Call History).

    hr = PhoneOpenCallLog(&hCallLog);
    
    pEntry.cbSize = sizeof(CALLLOGENTRY);
    while (PhoneGetCallLogEntry(hCallLog, &pEntry) == S_OK)
    {
    	if (pEntry.iom == IOM_MISSED)
    	{
    		calls++;
    	}
    }
    PhoneCloseCallLog(hCallLog);
    Any ideas?

    Thanks

    Lionel
    "The moon could not continue shining if it had to pay attention to all the dogs barking at it."
    • Proposed as answer by installer09 Friday, July 17, 2009 12:15 PM
    Thursday, July 16, 2009 1:18 PM
  • Hi,

    Try like the following. It works for me...
    void MissedcallCallBack(HREGNOTIFY hNotify, DWORD dwUserData, const PBYTE pData, const UINT cbData)
    {
    printf("You have missed call");
    }
    
    void registerMissedcall()
    {
    HREGNOTIFY hNotify;
     
    REGISTRYNOTIFYCALLBACK regCallBack = MissedcallCallBack;
    RegistryNotifyCallback(SN_PHONEMISSEDCALLS_ROOT, SN_PHONEMISSEDCALLS_PATH, SN_PHONEMISSEDCALLS_VALUE, regCallBack, 0, NULL, &hNotify));
    
    }

    Azad.S
    • Marked as answer by Y-Lionel Thursday, July 16, 2009 2:16 PM
    Thursday, July 16, 2009 1:20 PM
  • Funny enough, this works, thanks. I think it strange that my original code doesn't work though as it checks the same registry keys (I found the keys I was using in snapi.h).

    "The moon could not continue shining if it had to pay attention to all the dogs barking at it."
    Thursday, July 16, 2009 2:20 PM