# C1.Util.DX.ComObject.QueryInterfaceOrNull

## Content

<div class="doc-site-dotnet-api-container">



<h1 id="C1_Util_DX_ComObject_QueryInterfaceOrNull_" data-uid="C1.Util.DX.ComObject.QueryInterfaceOrNull*">QueryInterfaceOrNull Method
</h1>
<div class="markdown level0 summary"></div>
<div class="markdown level0 conceptual"></div>



<a id="C1_Util_DX_ComObject_QueryInterfaceOrNull_" data-uid="C1.Util.DX.ComObject.QueryInterfaceOrNull*"></a>
<h4 id="C1_Util_DX_ComObject_QueryInterfaceOrNull_System_Guid_" data-uid="C1.Util.DX.ComObject.QueryInterfaceOrNull(System.Guid)">QueryInterfaceOrNull(Guid)</h4>
<div class="markdown level1 summary"><p>Query 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">public virtual IntPtr QueryInterfaceOrNull(Guid guid)</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Public Overridable Function QueryInterfaceOrNull(guid As Guid) 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>
  </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><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.intptr">IntPtr</a></td>
      <td></td>
    </tr>
  </tbody>
</table>


<a id="C1_Util_DX_ComObject_QueryInterfaceOrNull_" data-uid="C1.Util.DX.ComObject.QueryInterfaceOrNull*"></a>
<h4 id="C1_Util_DX_ComObject_QueryInterfaceOrNull__1_System_IntPtr_" data-uid="C1.Util.DX.ComObject.QueryInterfaceOrNull``1(System.IntPtr)">QueryInterfaceOrNull&lt;T&gt;(IntPtr)</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 QueryInterfaceOrNull&lt;T&gt;(IntPtr comPointer) where T : ComObject</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Public Shared Function QueryInterfaceOrNull(Of T As ComObject)(comPointer As IntPtr) 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.intptr">IntPtr</a></td>
      <td><span class="parametername">comPointer</span></td>
      <td><p>A pointer to a 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>


<a id="C1_Util_DX_ComObject_QueryInterfaceOrNull_" data-uid="C1.Util.DX.ComObject.QueryInterfaceOrNull*"></a>
<h4 id="C1_Util_DX_ComObject_QueryInterfaceOrNull__1" data-uid="C1.Util.DX.ComObject.QueryInterfaceOrNull``1">QueryInterfaceOrNull&lt;T&gt;()</h4>
<div class="markdown level1 summary"><p>Query Interface for a particular 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 QueryInterfaceOrNull&lt;T&gt;() where T : ComObject</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Public Overridable Function QueryInterfaceOrNull(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 or null if it is not supported</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></td>
    </tr>
  </tbody>
</table>
</div>
