Concurrency question. Any ideas?

A

andrei

Hi,

The Addin I developed is not working as expected. If
somebody can guess what is happening, or suggest another
way...

The Addin performs lookup of Outlook Folders at each
NewMail event, AND at specific time interval. To generate
timer events:

1. Addin at initialization creates a button:
Set myButton = oStandardBars.Control.Add(1)
2. After creating a button, it spawns a thread from
the C++ DLL and returns;
3. Thread is setting up a WaitableTimer;
4. WaitableTimer, when triggered, does (in VB notation):
Set outlookApp = CreateObject("Outlook.Application")
outlookApp.ActiveExplorer.CommandBars. _
FindControl("My custom button").Execute
5. Addin receives event myButton_Click inside the same
Addin context.

Both _NewMail and _Click are calling the same VB
function. That function uses CriticalSection on
entry/exit. However, if they happen to occur
simultaneously, Outlook freezes.

What could possibly happen?

- VB supposed to be safe for worker threads (is it?)
- I never seen warnings about calling Outlook from
several different threads/processes simultaneously (but I
have very little experience with it)

Any comments/suggestions greatly appreciated.
TIA
andrei
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top