POOM notifications problem

This forum contains short topics that require short answers. Developers arround the world are welcomed to help the community, or to post their own questions.
[C++ development]

Moderators: Teksoft, admin

POOM notifications problem

Postby Vladimir Kostanda » Mon Feb 12, 2007 8:06 pm

I am trying to get POOM notification messages when POOM contacts are changed from some other process.
I register a window class and create a window for this purpose. I also set notification properties of the contacts folder as described in POOM documentation. All calls returns successfully. WM_CREATE and WM_DESTROY messages are sent to my window proc. But I do not receive any notification messages when contacts are changed, added or deleted from the contacts folder. Does anybody can give me some advises on this issue.
Fragments of my code are:
Code: Select all
      WNDCLASS wndClass;
      ZeroMemory(&wndClass, sizeof(wndClass));
      wndClass.lpfnWndProc = m_fnNotifyWindowProc;
      wndClass.lpszClassName = L"PhoneBookNotifyWindowClass";
      wndClass.hInstance = g_hInstance;
      ATOM aResult = RegisterClass(&wndClass);
      m_hNotifyWnd = CreateWindow(L"PhoneBookNotifyWindowClass", L"PhoneBookNotifyWindow", 0, 0, 0, 0, 0, NULL, NULL, wndClass.hInstance, 0);


Code: Select all
      hResult = m_spContactsFolder->QueryInterface(IID_IItem, (LPVOID*)&m_spItem);

      // Set the folder's properties.
      CEPROPVAL propval = {0};
      propval.propid = PIMPR_FOLDERNOTIFICATIONS;
      propval.val.ulVal = PIMFOLDERNOTIFICATION_REMOTE;
      hResult = m_spItem->SetProps(0, 1, &propval);


Testing for errors was removed to improve readability.

g_hInstance is valid.
I have already tried PIMFOLDERNOTIFICATION_LOCAL and PIMFOLDERNOTIFICATION_ALL flags. Everything's in vain. Notifications aren't sent even for inproc contacts changes.
Any help on the topic will be appreciated. Thanks in advance
V. Kostanda
Vladimir Kostanda
TEK-Newbie
TEK-Newbie
 
Posts: 9
Joined: Sat Jan 27, 2007 12:32 pm
Location: Ukraine

Postby Houser » Wed Feb 14, 2007 9:09 am

Have you set your window in the Logon() function:

Code: Select all
IPOutlookApp* m_pPoom;

hr = CoCreateInstance(   CLSID_Application,
         NULL,
         CLSCTX_INPROC_SERVER,
         IID_IPOutlookApp,
         (LPVOID*) &m_pPoom );
      
      // Logon to the POOM session.
      // Pass-in a valid handle to the POOM session parent window
      // so the notifications can be processed from it's wndproc.
      // Outlook Mobile uses this handle for each PIM item's Display call,
      // as well as for the infrared transfer dialog.

      hr = m_pPoom->Logon( (long) m_hWndNotify );

HRESULT CDatabaseNotifier::SubscribeToNotifications(IPOutlookApp *pPoom, OlDefaultFolders olFolder, uint uiNotificationsType)
{
    HRESULT   hr       = 0;
    IFolder   *pFolder = NULL;
    IItem     *pItem   = NULL;
    CEPROPVAL propval  = {0};

   log(( TEXT("SubscribeToNotifications: <%d> <%d>"), olFolder, uiNotificationsType ));
   
    // Get the folder for the item type.
    hr = pPoom->GetDefaultFolder(olFolder, &pFolder);
   if( FAILED(hr) )
   {
      err(( TEXT("GetDefaultFolder failed <%lu>!"), hr ));
      return hr;
   }


    // Get the IItem interface for the IFolder.
    hr = pFolder->QueryInterface(IID_IItem, (LPVOID*)&pItem );
   if( FAILED(hr) )
   {
      err(( TEXT("QueryInterface failed <%lu>!"), hr ));

      pFolder->Release();
      return hr;
   }

    // Set the folder's properties.
    propval.propid      = PIMPR_FOLDERNOTIFICATIONS;
    propval.val.ulVal   = uiNotificationsType;

    hr = pItem->SetProps(0, 1, &propval);
   if( FAILED(hr) )
   {
      err(( TEXT("SetProps failed <%lu>!"), hr ));
   }

    pItem->Release();
    pFolder->Release();

    return hr;
}



This code works for me.

Houser
Houser
TEK-Seeker
 
Posts: 17
Joined: Mon Nov 13, 2006 2:11 pm
Location: Germany

Postby Vladimir Kostanda » Thu Feb 15, 2007 7:44 pm

Thank You very much for your reply.
I have already fixed the problem. The issue was that I have forgotten to place a message loop in the main application thread :)
V. Kostanda
Vladimir Kostanda
TEK-Newbie
TEK-Newbie
 
Posts: 9
Joined: Sat Jan 27, 2007 12:32 pm
Location: Ukraine

Postby Houser » Fri Feb 16, 2007 10:21 am

Funny that I has made the same mistake at my first try. ;)

Houser
Houser
TEK-Seeker
 
Posts: 17
Joined: Mon Nov 13, 2006 2:11 pm
Location: Germany


Return to Pocketpc

Who is online

Users browsing this forum: No registered users and 1 guest


cron