View Single Post
  #1   Report Post  
Posted to microsoft.public.dotnet.framework.interop,microsoft.public.excel.programming
Tom Tom is offline
external usenet poster
 
Posts: 2
Default Office Add-ins and threads

Hi,

Is it possible to safely run threads in a VSTO Excel 2003 Add-in?

I run my thread as a STA thread like this:

thread = new System.Threading.Thread(TestThread);
thread.IsBackground = true;
thread.Name = "Test thread";

thread.SetApartmentState(System.Threading.Apartmen tState.STA);

I started to get "DisconnectedContext was detected" warnings from the
MDA right hafter I added a class library project to my add-in
solution.

Is there some magic trick to fix this or do I have to forget about
using threads and start calling Application.DoEvents every now and
then?

Br,
Tom