SWbemLastError.CompareTo_ method

The CompareTo_ method of the SWbemLastError 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.


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


objwbemObject [in]

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

iFlags [in, optional]

An integer that specifies additional flags to the operation. This parameter specifies the object characteristics to consider when object comparisons are made. You can use wbemComparisonFlagIncludeAll to consider all features (default) or any combination of the following values.

wbemComparisonFlagIncludeAll (0 (0x0))

Causes all properties, qualifiers, and flavors to be compared.

wbemComparisonFlagIgnoreQualifiers (1 (0x1))

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

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.

wbemComparisonFlagIgnoreDefaultValues (4 (0x4))

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

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.

wbemComparisonFlagIgnoreCase (16 (0x10))

Causes string values to be compared 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.

wbemComparisonFlagIgnoreFlavor (32 (0x20))

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

Return value

The CompareTo_ method returns the Boolean value TRUE if the objects match; otherwise, it returns FALSE.

Error codes

Upon 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.


Minimum supported client

Windows Vista

Minimum supported server

Windows Server 2008



Type library








See also