共用方式為


3.1.4.1.5 QueryS (Opnum 11)

The QueryS method is called by the client to query a specific event class or subscription.

 [id(5), helpstring("method QueryS")] HRESULT QueryS(
   [in] BSTR progID,
   [in] BSTR queryCriteria,
   [out, retval] IUnknown** ppInterface
 );

progID: A string that uniquely identifies the type of collection. The value MUST be one of the following.

Value

Meaning

"EventSystem.EventClassCollection"

The store for event classes (as specified in section 3.1.1.1).

"EventSystem.EventSubscriptionCollection"

The store for subscriptions (as specified in section 3.1.1.2).

queryCriteria: The actual query string. The syntax for this string MUST conform to section 2.2.1.

ppInterface: If the method returns success, this MUST contain an interface pointer that represents the collection of the event classes or subscriptions based on the criteria specified in the queryCriteria parameter.

Return Values: 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.

Return value/code

Description

0x80040203

EVENT_E_QUERYSYNTAX

A syntax error occurred while trying to evaluate a query string.

0x80040204

EVENT_E_QUERYFIELD

An invalid field name was used in a query string.

When this method is invoked, the server MUST use the progID 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 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 use the query criteria to attempt to return the first object that matches the criteria, and fail the call if it cannot. The object MUST be a DCOM object that MUST support the IEventClass and IEventClass2 interfaces and MAY<10> support the IEventClass3 interface if the object is an event class. It MUST support IEventSubscription and IEventSubscription2 and MAY<11> support IEventSubscription3 if it is a subscription object. This object MUST be stored in a collection-based DCOM object supporting IEventObjectCollection which MUST be returned through the ppInterface parameter.