IWbemHiPerfProvider::CreateRefresher method

The IWbemHiPerfProvider::CreateRefresher method creates a refresher. The returned refresher will be used in subsequent calls to IWbemHiPerfProvider::CreateRefreshableEnum, IWbemHiPerfProvider::CreateRefreshableObject, and IWbemHiPerfProvider::StopRefreshing.

Note  If a provider does not implement this method, it must return WBEM_E_PROVIDER_NOT_CAPABLE. A provider must implement this method to support refresher operations.
 

Syntax

HRESULT CreateRefresher(
  IWbemServices  *pNamespace,
  long           lFlags,
  IWbemRefresher **ppRefresher
);

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.

lFlags

Reserved. This parameter must be 0 (zero).

ppRefresher

Pointer to hold the reference to the provider's implementation of the IWbemRefresher interface.

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 provider must supply its own implementation of the IWbemRefresher interface. It is valid for WMI to request multiple refreshers, each of which will be used for its own refresh operations.

When you release a refresher, the provider should clean up any refreshable objects or enumerators that were added to the refresher.

Examples

The following code example describes how to implement CreateRefresher.

C++
HRESULT CHiPerfProvider::CreateRefresher(
  /* [in] */IWbemServices *pNamespace,
  /* [in] */ long lFlags,
  /* [out] */ IWbemRefresher** ppRefresher
)
{
    // Allocate a new refresher
    //For Example:
    // CMyRefresher* pMyRefresher = new CMyRefresher();
// Return the refresher to the ppRefresher
// [out] parameter
/*return pMyRefresher->QueryInterface(
 IID_IWbemRefresher, (void**) ppRefresher );*/

}

// Free memory resources. // For Example: //pNamespace->Release(); //ppRefresher->Release(); //delete[] pMyRefresher;

Requirements

   
Windows version Windows Vista Windows Server 2008
Target Platform Windows
Header wbemprov.h (include Wbemidl.h)
Library Wbemuuid.lib
DLL Wmiprvsd.dll

See Also

Developing a WMI Provider

IWbemHiPerfProvider

Making an Instance Provider into a High-Performance Provider

Performance Counter Provider

Writing an Instance Provider