title: Calling DirectShow in Unmanaged code
body: <p>I am working on a C# WPF application which calls an unmanaged C++ DLL functions using PInvoke. The PInvoke functions are called from a WPF thread whose apartment state is set to MTA.
  The PInvoke calls works fine.</p>
  
  <p>The unmanaged C++ DLL uses DirectShow functions to create a window to show a video feed. For eg.  <code>CoInitializeEx(NULL, COINIT_MULTITHREADED)</code> is called when a PInvoke function is called to initialize DirectShow. The DirectShow code works fine (no errors are seen). It is supposed to open a window and show the video feed. But the window does not open (it opens for an instant and then disappears). </p>
  
  <p>Any idea why the direct show window isn't opening. Nothing stops me from opening a window from an unmanaged dll as far as I know.</p>
  
  <p>EDIT: I get the same result when I call the DLL from a normal C# application (no wpf).</p>