Redigera

Dela via


SWbemObject.CompareTo_ method

The CompareTo_ method of the SWbemObject object compares two SWbemObject objects. This comparison is subject to certain constraints based on the values specified in the iFlags parameter.

For an explanation of this syntax, see Document Conventions for the Scripting API.

Syntax

bAreEqual = .CompareTo_( _
  ByVal objwbemObject, _
  [ ByVal iFlags ] _
)

Parameters

objwbemObject [in]

Required. This parameter is an SWbemObject object. This is the object with which the first object is compared. The object must be a valid SWbemObject instance.

iFlags [in, optional]

Specifies the object characteristics to consider when comparing an object with other objects. You can use wbemComparisonFlagIncludeAll to consider all features (this is the default), or any combination of the following values.

wbemComparisonFlagIncludeAll (0 (0x0))

Compares all properties, qualifiers, and flavors.

wbemComparisonFlagIgnoreObjectSource (2 (0x2))

Causes the source of the objects, namely the server and the namespace they came from, to be ignored in comparison to other objects.

wbemComparisonFlagIgnoreQualifiers (1 (0x1))

Causes all qualifiers (including Key and Dynamic) to be ignored in comparison.

wbemComparisonFlagIgnoreDefaultValues (4 (0x4))

Causes default values of properties to be ignored. This flag is only meaningful when comparing classes.

wbemComparisonFlagIgnoreFlavor (32 (0x20))

Causes qualifier flavors to be ignored. This flag takes qualifier values into account, but ignores flavor distinctions such as propagation rules and override restrictions.

wbemComparisonFlagIgnoreCase (16 (0x10))

Compares string values in a case-insensitive manner. This applies both to strings and to qualifier values. Property and qualifier names are always compared in a case-insensitive manner whether this flag is specified or not.

wbemComparisonFlagIgnoreClass (8 (0x8))

Instructs the system to assume that the objects being compared are instances of the same class. Consequently, this flag compares instance-related information only. Use this flag to optimize performance. If the objects are not of the same class, the results are undefined.

Return value

This method returns the Boolean value of TRUE if the objects match. It returns FALSE if the objects do not match.

Error codes

After the completion of the CompareTo_ method, the Err object may contain one of the error codes in the following list.

wbemErrFailed - 2147749889 (0x80041001)

Unspecified error.

wbemErrInvalidParameter - 2147749896 (0x80041008)

A specified parameter is not valid.

wbemErrOutOfMemory - 2147749894 (0x80041006)

Not enough memory to complete the operation.

Requirements

Requirement Value
Minimum supported client
Windows Vista
Minimum supported server
Windows Server 2008
Header
Wbemdisp.h
Type library
Wbemdisp.tlb
DLL
Wbemdisp.dll
CLSID
CLSID_SWbemObject
IID
IID_ISWbemObject

See also

SWbemObject