Forcing a Notification
Applies to: Office 2010 | Outlook 2010 | Visual Studio
When service providers use the IMAPISupport : IUnknown methods for notification, MAPI delivers notifications using a hidden window and its corresponding window procedure. For each process to receive a notification, MAPI posts a special message to the hidden window. This message is named with the constant szMAPINotificationMsg which is defined in MAPIDEFS.H.
You receive these notifications when the hidden window's window procedure processes the szMAPINotificationMsg message. To guarantee that notifications are delivered, it is necessary to wait for and dispatch this szMAPINotificationMsg message. Implementing the logic to achieve this can be done fairly simply, but MAPI provides an entry point into the MAPI DLL called HrDispatchNotifications to make processing even simpler. Call HrDispatchNotifications as follows to receive notifications in your client:
HRESULT hr = HrDispatchNotifications(0);