RunWorkerCompleted call from worker thread in VB CCW

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a .net library with backgroundWorker object, and it is working fine in
..net environment. Then I exposes the library to VB application to call. Using
standard Callable COM Wrapper (CCW) method, the method can be called, but I
notice that backgroundWorker_RunWorkerCompleted() method will be called from
worker thread, instead of the main thread. And eventually throw exception in
my side as some UI are updated in RunWorkerCompleted method.

Is it a known issue from Microsoft?
 
You need to use the Control.InvokeRequired property to check whether you are
on the UI thread and if not (true from prop), call invoke.
 
Back
Top