IFunctionInstanceCollectionQuery::AddQueryConstraint method (functiondiscoveryapi.h)

[Function Discovery is available for use in the operating systems specified in the Requirements section. It may be altered or unavailable in subsequent versions.]

The AddQueryConstraint method adds a query constraint to the query.

This method enables the application to filter the result set to only those instances that fulfill this constraint.

Syntax

HRESULT AddQueryConstraint(
  [in] const WCHAR *pszConstraintName,
  [in] const WCHAR *pszConstraintValue
);

Parameters

[in] pszConstraintName

The query constraint.

[in] pszConstraintValue

The constraint value.

Return value

Possible return values include, but are not limited to, the following.

Return code Description
S_OK
The method completed successfully.
E_OUTOFMEMORY
The method is unable to allocate the memory required to perform this operation.

Remarks

If multiple constraints are added, all constraints must be supported to satisfy the query.

AddQueryConstraint will fail with an error if the IFunctionInstanceCollectionQuery object includes all subcategories and the AddQueryConstraint method is called with the pszConstraintName parameter set to FD_QUERYCONSTRAINT_PROVIDERINSTANCEID. To avoid this error, create a IFunctionInstanceCollectionQuery object that does not include all subcategories. You can create such an object by calling CreateInstanceCollectionQuery with the fIncludeAllSubCategories parameter set to false.

Requirements

Requirement Value
Minimum supported client Windows Vista [desktop apps only]
Minimum supported server Windows Server 2008 [desktop apps only]
Target Platform Windows
Header functiondiscoveryapi.h
DLL FunDisc.dll

See also

Constraint Definitions

Function Discovery Queries

IFunctionInstanceCollectionQuery