Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

IWbemRefresher::Refresh method

The IWbemRefresher::Refresh method updates all refreshable objects, enumerators, and nested refreshers. The WMI Refresher calls this function in response to a client request to Refresh.

Syntax


HRESULT Refresh(
  [in]  long lFlags
);

Parameters

lFlags [in]

Bitmask of flags that modify the behavior of this method.

If WBEM_FLAG_REFRESH_AUTO_RECONNECT is specified and if the connection is broken, the refresher attempts to reconnect to the provider automatically. This is the default behavior for this method.

If you do not want the refresher to attempt to reconnect to the provider, specify WBEM_FLAG_REFRESH_NO_AUTO_RECONNECT.

Return value

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

Return codeDescription
WBEM_S_NO_ERROR

The method was successful.

WBEM_E_INVALID_PARAMETER

A specified parameter is not valid.

WBEM_E_REFRESHER_BUSY

The refresher is busy with another operation.

WBEM_E_FAILED

The provider failed internally, even though the operation was valid.

 

Remarks

When refreshing enumerators and objects, providers should take as little time as possible. Using the IWbemObjectAccess methods and caching property handles for reuse can dramatically improve performance. When updating enumerators, a provider can either remove and re-instantiate all objects, or simply remove and add the changed instances. It is up to you to choose the best approach. In either case, caching instances can improve performance.

The provider should only access the objects and enumerators in a refresher in response to a call to IWbemRefresher::Refresh. It would, however, be perfectly valid to have a background thread polling for data with which to fill these objects, to prepare for when Refresh is called.

Examples

For script code examples, see WMI Tasks for Scripts and Applications and the TechNet ScriptCenter Script Repository.

For C++ code examples, see WMI C++ Application Examples.

The following code example describes how to implement Refresh.


HRESULT CMyHiPerfProviderRefresher::Refresh(
/* [in] */long lFlags
)
{
  // Run through all the objects and update their
  // data.

  // Now run through the enumerators.
  // Empty the enumerator and refill it.
   

  return WBEM_S_NO_ERROR;
}

Requirements

Minimum supported client

Windows XP

Minimum supported server

Windows Server 2003

Header

Wbemcli.h (include Wbemidl.h)

Library

Wbemuuid.lib

DLL

Wbemperf.dll

See also

IWbemRefresher
Developing a WMI Provider
Writing an Instance Provider
Making an Instance Provider into a High-Performance Provider
IWbemHiPerfProvider
Performance Counter Provider

 

 

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft. All rights reserved.