# C1.Util.DX.ComObject.QueryInterface

## Content

<div class="doc-site-dotnet-api-container">



<h1 id="C1_Util_DX_ComObject_QueryInterface_" data-uid="C1.Util.DX.ComObject.QueryInterface*">QueryInterface Method
</h1>
<div class="markdown level0 summary"></div>
<div class="markdown level0 conceptual"></div>



<a id="C1_Util_DX_ComObject_QueryInterface_" data-uid="C1.Util.DX.ComObject.QueryInterface*"></a>
<h4 id="C1_Util_DX_ComObject_QueryInterface_System_Guid_System_IntPtr__" data-uid="C1.Util.DX.ComObject.QueryInterface(System.Guid,System.IntPtr@)">QueryInterface(Guid, out nint)</h4>
<div class="markdown level1 summary"><p>Query this instance for a particular COM GUID/interface support.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">[CLSCompliant(false)]
public virtual void QueryInterface(Guid guid, out nint outPtr)</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">&lt;CLSCompliant(False)&gt;
Public Overridable Sub QueryInterface(guid As Guid, ByRef outPtr As IntPtr)</code></pre>
</div>
<h5 class="parameters">Parameters</h5>
<table class="table table-bordered table-condensed">
  <thead>
    <tr>
      <th>Type</th>
      <th>Name</th>
      <th>Description</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.guid">Guid</a></td>
      <td><span class="parametername">guid</span></td>
      <td><p>GUID query interface</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.intptr">nint</a></td>
      <td><span class="parametername">outPtr</span></td>
      <td><p>output object associated with this GUID, IntPtr.Zero in interface is not supported</p>
</td>
    </tr>
  </tbody>
</table>


<a id="C1_Util_DX_ComObject_QueryInterface_" data-uid="C1.Util.DX.ComObject.QueryInterface*"></a>
<h4 id="C1_Util_DX_ComObject_QueryInterface__1" data-uid="C1.Util.DX.ComObject.QueryInterface``1">QueryInterface&lt;T&gt;()</h4>
<div class="markdown level1 summary"><p>Query this instance for a particular COM interface support.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">public virtual T QueryInterface&lt;T&gt;() where T : ComObject</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Public Overridable Function QueryInterface(Of T As ComObject)() As T</code></pre>
</div>
<h5 class="returns">Returns</h5>
<table class="table table-bordered table-condensed">
  <thead>
    <tr>
      <th>Type</th>
      <th>Description</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><span class="xref">T</span></td>
      <td><p>An instance of the queried interface</p>
</td>
    </tr>
  </tbody>
</table>
<h5 class="typeParameters">Type Parameters</h5>
<table class="table table-bordered table-condensed">
  <thead>
    <tr>
      <th>Name</th>
      <th>Description</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><span class="parametername">T</span></td>
      <td><p>The type of the COM interface to query</p>
</td>
    </tr>
  </tbody>
</table>


<a id="C1_Util_DX_ComObject_QueryInterface_" data-uid="C1.Util.DX.ComObject.QueryInterface*"></a>
<h4 id="C1_Util_DX_ComObject_QueryInterface__1_System_Object_" data-uid="C1.Util.DX.ComObject.QueryInterface``1(System.Object)">QueryInterface&lt;T&gt;(object)</h4>
<div class="markdown level1 summary"><p>Queries a managed object for a particular COM interface support.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">public static T QueryInterface&lt;T&gt;(object comObject) where T : ComObject</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Public Shared Function QueryInterface(Of T As ComObject)(comObject As Object) As T</code></pre>
</div>
<h5 class="parameters">Parameters</h5>
<table class="table table-bordered table-condensed">
  <thead>
    <tr>
      <th>Type</th>
      <th>Name</th>
      <th>Description</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object">object</a></td>
      <td><span class="parametername">comObject</span></td>
      <td><p>The managed COM object.</p>
</td>
    </tr>
  </tbody>
</table>
<h5 class="returns">Returns</h5>
<table class="table table-bordered table-condensed">
  <thead>
    <tr>
      <th>Type</th>
      <th>Description</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><span class="xref">T</span></td>
      <td><p>An instance of the queried interface</p>
</td>
    </tr>
  </tbody>
</table>
<h5 class="typeParameters">Type Parameters</h5>
<table class="table table-bordered table-condensed">
  <thead>
    <tr>
      <th>Name</th>
      <th>Description</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><span class="parametername">T</span></td>
      <td><p>The type of the COM interface to query</p>
</td>
    </tr>
  </tbody>
</table>
</div>
