views:

169

answers:

2

Hi,

My application is implemented as a service (running under services.exe). I am adding a new feature which requires being notified when the user sends an SMS.

I have tried using IMAPIAdviseSink, registering with both IMAPISession and IMsgStore, but I do not get any notifications.

The other options I can see are to create a Short Message Service Provider or to implement the IFormProviderEx interface, but I am not sure about the impact this might have on SMS functionality and the user experience.

Is there any way in which my application can reliably get notifications of SMSs being created in the Outbox?

edit: The app is written in native C++. I've looked into RIL and several other APIs, but I can only find information about getting notified of incoming SMSs.

OK, some more information: The same code for registering my IMAPIAdviseSink works in a stand alone app. It's only failing to get notifications in the service.

Is there anyway to get notifications in my service? Or do I need a separate process to monitor SMS events and notify my service?

Mark

A: 

edit: oops, missed that it was users creating the message, not incoming.

Are you targetting windows mobile 5+?

I think what you're looking for is the MessageInterceptor class in the Microsoft.WindowsMobile.PocketOutlook.MessageInterception Namespace.

Here is a link to some example code: http://www.knowdotnet.com/articles/smartphonesms.html

Peter Foot has included a similar function in His In the Hand libraries, they might allow you to do the same on earlier version of pocket pc.

Steven Adams
+2  A: 

You can't use IMAPIAdviseSink from a service.

You need to use it from separate process and notify the service of the events you're interested in.

Mark Cheeseborough