ActiveX control in new thread goes slow

  • Thread starter Thread starter Martin Baker
  • Start date Start date
M

Martin Baker

I have an activeX control which I am calling from a C# program, this works
fine.

I now want to call the activeX control from a seperate thread, this works
but is very slow. This is far too slow to work properly, can anyone suggest
how I can fix this?

The program is not doing anything else while the thread is running, the idea
is that the thread will be running continously in a loop to animate the
activeX control. However it runs slow from the start (only when in a
seperate thread) even in its first time through the loop.

I have tried setting the ApartmentState to single threaded or multi threaded
but this make no difference:
Thread t = new Thread (new ThreadStart(a.work));
// t.ApartmentState = ApartmentState.STA; // control is single threaded
t.ApartmentState = ApartmentState.MTA; // control is multi threaded

I have tried setting the priority to Lowest, Normal or Highest but this make
no difference either:
//t.Priority=System.Threading.ThreadPriority.Lowest;
//t.Priority=System.Threading.ThreadPriority.Normal;
t.Priority=System.Threading.ThreadPriority.Highest;

Information and code for the activeX control I am using is here:
http://www.euclideanspace.com/mjbWorld/programmersGuide/languageSpecific/net
Specific/createATL/

I would appeciate and ideas I can try to fix this, thanks,

Martin
 
Martin,

I suspect that the code in the thread is the culprit, not how you are
setting the thread up.

Can you show the code in the work method on the instance of a?
 
Back
Top