title: COM - .NET Interop - Winform from COM client
body: <p>I have a .NET application containing a WinForm. This WinForm contains an unmanaged ActiveX control and a few other controls. This application works fine in standalone mode. Now we want to publish some kind of interface so this Winform can be used from unmanaged C++/MFC applications using Interop functionality. The client applications will Show this form in a modeless manner. When the user inputs the details the same are passed to the client using COM event source/sink (or connection point) method.</p>
  
  <p>I have followed various articles and one of the method that works for us is 
  <a href="http://codebetter.com/blogs/peter.van.ooijen/archive/2005/06/03/64041.aspx" rel="nofollow noreferrer">http://codebetter.com/blogs/peter.van.ooijen/archive/2005/06/03/64041.aspx</a></p>
  
  <p>But if I start more than one thread from the same client application, the second instance of form throws access violation exceptions because the ActiveX control on the form expects the thread to always be a UI thread (based on my observation).</p>
  
  <p>Could you tell me what is the right way to expose a WinForm functionality to unmanaged client applications via Interop? </p>
  
  <p>Many thanks</p>