CAB exposed as COM and multithreading

Topics: CAB & Smart Client Software Factory
May 6, 2006 at 11:42 AM
originally posted by: SkreetchinTires

Here's a good one!

Our large client/server enterprise application is migrating to .NET, 3000+ servers in scale. A portion of the current unmanaged client provides new funtionality via COM call to the our new CAB application. This is done with a FormShellApplication wrapper class having COM visible methods.

When the unmanaged client needs the new CAB shell app, it instanciates the wrapper class and then calls methods, supplying a dispatch ID, to request action. The wrapper class then calls the static ShellApplication.Main method and the CAB is up and running, complete with it's own message pump. The modules subscribe to 'commands' and presents the user content.

When done in the CAB, a call is made back using the provided dispatch ID to the unmanaged client for further processing.

And here is the problem. That call needs to be made on the unmanaged clients thread. I tried saving SynchronizationContext.Current in the wrapper, but it is null. How can I execute a method on the thread that originally instanciated the wrapper, the unmanaged clients thread?

Iv'e seen ya'lls work, I'm sure you'll love thinking this one over.