views:

55

answers:

1

Hi,

I have a Visual Basic 6 application that uses a timer to poll Outlook 2003 for incoming messages using the msoutl.olb automation object library. Lets call the application MailPoler.

Based on the messages certain operations gets performed blah blah...

MailPoler runs "very smoothly" and I have ensured that the error handler captures and logs any possible error.

The problem I am facing is that after a certain period (1 to 2 days) the MailPoler will go into a freeze. Outlook hasn't frozen.

Has anyone encountered a similar issue? I have eliminated the possibility of a security issue. Due to the application being able to access Outlook in the first place.

Thanks.

+1  A: 

I suppose error handling code is implemented on each and every function/sub your app has. If nothing gets logged there then create a separate log that's logging entry/exit points of each routine.

wqw
I already tried it. Its like the application just freezes and I have nothing to go by. I even considered adding logging for a history of all functions called. I am even considering to write a Outlook 2003 Plug-In. If it was up to me I would have already. VB6 Argggg.
Koekiebox
Do you implement events on some outlook classes i.e. `Private WithEvents m_oMySink As OutlookClass`? Try reconnecting these on certian period of time.
wqw
I have implemented a time that connects in intervals of 60 seconds. Is this sufficient? Or would the event be best practice?
Koekiebox
Best practice - no. Desperate hack - yes :-)) Probably the outlook object gets disconnected due to an exception but you never get notified about it so your marshaling proxy becomes loose (dangling). Implementing a "heartbeat" to test your references by calling a single (fast) method on them is also viable. This or reconnecting will probably throw an error but at least you'll know something is wrong with the server application.
wqw
I found that the <code>_NewMail Application</code> event does the trick. Thanks.See http://msdn.microsoft.com/en-us/library/bb147645.aspx
Koekiebox