title: Accessing object in RunningObjectTable (C#)
body: <p>I've two applications. The first application registers an object with a ProgID in the RunningObjectTable.. that works totally fine. The other application should access that object by the ProgID.</p>
  
  <p>I found three possible ways to do so.. but just one works and I wonder why.. what are the differences between these ways?</p>
  
  <p>First: <a href="https://msdn.microsoft.com/de-de/library/windows/desktop/ms683841(v=vs.85).aspx" rel="nofollow noreferrer">IRunningObjectTable.GetObject(...)</a> => not working</p>
  
  <pre><code>IRunningObjectTable rot;
  GetRunningObjectTable(0, out rot); // =&gt; ole32.dll
  IMoniker moniker;
  CreateFileMoniker("myProgId", out moniker); // =&gt; ole32.dll
  object myObj;
  rot.GetObject(moniker, out myObj) // =&gt; myObj stays null
  </code></pre>
  
  <p>Second: <a href="https://msdn.microsoft.com/en-us//library/office/system.runtime.interopservices.marshal.getactiveobject(v=vs.71)" rel="nofollow noreferrer">Marshal.GetActiveObject(...)</a> => not working</p>
  
  <pre><code>object myObj = Marshal.GetActiveObject("myProgId"); // =&gt; throws an exception: MK_E_UNAVAILABLE
  </code></pre>
  
  <p>Third: <a href="https://msdn.microsoft.com/en-us//library/system.activator.createinstance(v=vs.110).aspx" rel="nofollow noreferrer">Activator.CreateInstance(...)</a> => works</p>
  
  <pre><code>object myObj = Activator.CreateInstance(Type.GetTypeFromProgID("myProgId"), true);
  </code></pre>