<div class="content"><p> </p><p>The Query method is called by a <span><a href="e74594a9-404c-4729-91f4-3fe4453cdf4d#gt_60e0e1fa-66fe-41e1-b5e3-ceab97e53506" data-linktype="relative-path">client</a></span> to query a
collection for a collection of <span><a href="66217d57-8c60-4423-9b24-52923f4c2afa" data-linktype="relative-path">event classes</a></span> or <span><a href="0d617a76-fc58-455c-9e30-1a8436c5f73a" data-linktype="relative-path">subscriptions</a></span>.</p><dl>
<dd>
<div><pre> [id(1), helpstring(&#34;method Query&#34;)] HRESULT Query(
   [in] BSTR progID,
   [in] BSTR queryCriteria,
   [out] int* errorIndex,
   [out, retval] IUnknown** ppInterface
 );
</pre></div>
</dd></dl><p><b>progID: </b>A string that identifies the type of
collection. The value MUST be one of the following.</p><dl>
<dd>
<table><thead>
  <tr>
   <th>
   <p>Value</p>
   </th>
   <th>
   <p>Meaning</p>
   </th>
  </tr>
 </thead><tbody><tr>
  <td>
  <p>&#34;EventSystem.EventClassCollection&#34;</p>
  </td>
  <td>
  <p>The store for <span><a href="e74594a9-404c-4729-91f4-3fe4453cdf4d#gt_e8df25db-9bff-46df-b607-d072dd29c02b" data-linktype="relative-path">event classes</a></span> (as
  specified in section 3.1.1.1). </p>
  </td>
 </tr><tr>
  <td>
  <p>&#34;EventSystem.EventSubscriptionCollection&#34;</p>
  </td>
  <td>
  <p>The store for <span><a href="e74594a9-404c-4729-91f4-3fe4453cdf4d#gt_f362c255-5746-44db-aa04-e8060543a19c" data-linktype="relative-path">subscriptions</a></span> (as
  specified in section 3.1.1.2).</p>
  </td>
 </tr></tbody></table>
</dd></dl><p><b>queryCriteria: </b>The actual query string. The
syntax for this string MUST conform to section <span><a href="540614a5-1aa5-4e6b-8867-ee10809706bf" data-linktype="relative-path">2.2.1</a></span>.</p><p><b>errorIndex: </b>The zero-based character index in
the <i>queryCriteria</i> parameter where an error has occurred. This can occur
if the syntax of the query string is incorrect, in which case <i>errorIndex</i>
specifies the index at which the problematic syntax is present in the <i>queryCriteria</i>
parameter.</p><p><b>ppInterface: </b>If the method returns a success <span><a href="../ms-dtyp/a9046ed2-bfb2-4d56-a719-2824afce59ac" data-linktype="relative-path">HRESULT</a></span>,
this MUST contain an <span><a href="e74594a9-404c-4729-91f4-3fe4453cdf4d#gt_e5ba77ec-1a10-4a4e-a980-c81942237b34" data-linktype="relative-path">interface pointer</a></span>
that represents the collection of the event classes or subscriptions based on
the criteria specified in the <i>queryCriteria</i> parameter. </p><p><b>Return Values: </b>An HRESULT that specifies
success or failure. All success codes MUST be treated the same, and all failure
codes other than EVENT_E_QUERYSYNTAX and EVENT_E_QUERYFIELD MUST be treated the
same.</p><dl>
<dd>
<table><thead>
  <tr>
   <th>
   <p>Return value/code</p>
   </th>
   <th>
   <p>Description</p>
   </th>
  </tr>
 </thead><tbody><tr>
  <td>
  <p>0x80040203</p>
  <p>EVENT_E_QUERYSYNTAX</p>
  </td>
  <td>
  <p>A syntax error occurred while trying to evaluate a
  query string.</p>
  </td>
 </tr><tr>
  <td>
  <p>0x80040204</p>
  <p>EVENT_E_QUERYFIELD</p>
  </td>
  <td>
  <p>An invalid field name was used in a query string.</p>
  </td>
 </tr></tbody></table>
</dd></dl><p>When this method is called, the <span><a href="e74594a9-404c-4729-91f4-3fe4453cdf4d#gt_434b0234-e970-4e8c-bdfa-e16a30d96703" data-linktype="relative-path">server</a></span> MUST use the <i>progID</i>
parameter value to determine the store against which the query needs to be
executed and validate the query. If the specified collection is not valid or if
the specified query is not valid, the server MUST fail the call and return a
failure HRESULT back to the client. Otherwise, the server MUST attempt to use
the <i>queryCriteria</i> parameter to retrieve a collection of event classes or
subscriptions based on the value of the <i>progID</i> parameter and fail the
call if it cannot. Each of the <span><a href="e74594a9-404c-4729-91f4-3fe4453cdf4d#gt_8bb43a65-7a8c-4585-a7ed-23044772f8ca" data-linktype="relative-path">objects</a></span> in the
collection MUST be wrapped by a DCOM object that MUST support the <span><a href="e9e3062a-41dc-43eb-8495-eb6cb70945e6" data-linktype="relative-path">IEventClass</a></span>
and <span><a href="2510bb77-b0ab-4254-b3b8-dd5c6189eef2" data-linktype="relative-path">IEventClass2</a></span>
interfaces and MAY<a id="Appendix_A_Target_8"></a><a aria-label="Product behavior note 8" href="aa52a2bf-fd29-47f9-8dea-d887d6b7d5ee#Appendix_A_8" data-linktype="relative-path">&lt;8&gt;</a> support the <span><a href="75a639ed-d605-4331-b5d3-bf7efb8f4edf" data-linktype="relative-path">IEventClass3</a></span>
interface if the object is an event class. It MUST support <span><a href="542e1c26-d18a-4686-a47e-8be9ca73e352" data-linktype="relative-path">IEventSubscription</a></span>
and <span><a href="48f7dd98-118d-4dce-8826-de75a3e631cc" data-linktype="relative-path">IEventSubscription2</a></span>,
and MAY<a id="Appendix_A_Target_9"></a><a aria-label="Product behavior note 9" href="aa52a2bf-fd29-47f9-8dea-d887d6b7d5ee#Appendix_A_9" data-linktype="relative-path">&lt;9&gt;</a> support <span><a href="cc19d39a-b232-4df9-9b8b-ac8459988a04" data-linktype="relative-path">IEventSubscription3</a></span>
if it is a subscription object. These DCOM objects MUST be encapsulated into a
collection-based DCOM object that supports the <span><a href="ac9b9d0e-1fe0-4ea8-a917-55b38055a1b2" data-linktype="relative-path">IEventObjectCollection</a></span>
interface. This object MUST be returned through the <i>ppInterface</i>
parameter.</p></div>