title: How to get instance of an underlying object from System.Diagnostics.Process
body: <p>Ok what I am trying to achieve is: </p>
  
  <p>Given I have a System.Diagnostics.Process object representing a running application (eg MS Excel) how do I go from having the Process object to holding the active Excel instance?</p>
  
  <p>Ideally it would be something like</p>
  
  <pre><code>Dim lProcess as System.Diagnostics.Process = ProcessOfActiveWindow()
  Dim lExcelInstance As Excel.Application
  
  lExcelInsance = DirectCast(lProcess, Excel.Application)
  </code></pre>
  
  <p>NOTE: </p>
  
  <ol>
  <li>The "DirectCast" is a subsitute for "a miricle occurs here" but hopefully you understand the desired result.</li>
  <li>I am not looking for how to get to excel specifically, I'm looking for the "general form" I can apply to any application I happen to know the library definition for.</li>
  </ol>