title: Marshal.QueryInterface() - How to use the returned value?
body: <p>I was trying to find an answer to this, but with no luck at all. There is no documentation on how to use the value returned by the <code>Marshal.QueryInterface</code> (in my case 'pISomething'). It is an instance of <code>IntPtr</code>, but I need it as instance of <code>ISomething</code>. Simple cast is not working. So, can somebody show how to use an interface returned by the <code>Marshal.QueryInterface</code>?</p>
  
  <p>example:</p>
  
  <pre><code>IBaseFilter pMyFilter = getMyFilter();
  
  IntPtr pUnknown = Marshal.GetIUnknownForObject(pMyFilter);
  
  IntPtr pISomething;
  int success = Marshal.QueryInterface(pUnknown, ref IID_ISomething, out pISomething);
  
  // success = 0 here!
  </code></pre>