IWbemConfigureRefresher::AddObjectByTemplate method (wbemcli.h)

With the IWbemConfigureRefresher::AddObjectByTemplate method, you can add an object you want refreshed to a refresher by specifying an IWbemClassObject instance template. Use this method when it is difficult to construct an object path for an object to add to a refresher.

Note  The key properties of the instance object must be filled out before you can call the AddObjectByTemplate method.
 

Syntax

HRESULT AddObjectByTemplate(
        IWbemServices    *pNamespace,
  [in]  IWbemClassObject *pTemplate,
  [in]  long             lFlags,
  [in]  IWbemContext     *pContext,
  [out] IWbemClassObject **ppRefreshable,
  [out] long             *plId
);

Parameters

pNamespace

An IWbemServices pointer back into Windows Management, which can service any request made by the provider. The provider should call AddRef on this pointer if it is going to call back into Windows Management during its execution.

[in] pTemplate

Pointer to a IWbemClassObject object that contains the instance template.

[in] lFlags

Bitmask of flags that modify the behavior of this method. If this parameter is set to WBEM_FLAG_USE_AMENDED_QUALIFIERS, the returned instance will contain localized qualifiers if available.

[in] pContext

Typically NULL; otherwise, a pointer to an IWbemContext object that is required by one or more dynamic class providers. The values in the context object must be specified in the specific provider documentation. For more information about this parameter, see Making Calls to WMI.

[out] ppRefreshable

Pointer to hold the reference to a IWbemClassObject object, which will contain the refreshable instance object. The client must call Release on the returned object when it is no longer required.

[out] plId

Pointer to an integer returned by the provider that uniquely identifies this refreshable object.

Return value

This method returns an HRESULT indicating the status of the method call. The following list lists the value contained within an HRESULT.

Remarks

The supplied instance must specify a valid object, which is provided by the High-Performance Provider. The returned object must not be modified by the client while a refresh operation is in process. The returned identifier can be used by the Remove function to remove the object.

It is not necessary for the user to explicitly remove added objects. The client must call Release on the returned object when it is no longer required.

Requirements

Requirement Value
Minimum supported client Windows Vista
Minimum supported server Windows Server 2008
Target Platform Windows
Header wbemcli.h (include Wbemidl.h)
Library Wbemuuid.lib

See also

Accessing Performance Data in C++

IWbemConfigureRefresher

Making an Instance Provider into a High-Performance Provider

Performance Counter Provider