IFunctionDiscoveryNotification::OnUpdate method (functiondiscoveryapi.h)

[Function Discovery is available for use in the operating systems specified in the Requirements section. It may be altered or unavailable in subsequent versions.]

Indicates that a function instance has been added, removed, or changed. This method is implemented by the client program and is called by Function Discovery.


  [in] QueryUpdateAction enumQueryUpdateAction,
  [in] FDQUERYCONTEXT    fdqcQueryContext,
  [in] IFunctionInstance *pIFunctionInstance


[in] enumQueryUpdateAction

A QueryUpdateAction value that specifies the type of action Function Discovery is performing on the specified function instance.

[in] fdqcQueryContext

The context registered for change notification. The type FDQUERYCONTEXT is defined as a DWORDLONG. This parameter can be NULL.

[in] pIFunctionInstance

An IFunctionInstance interface pointer that represents the function instance being affected by the update.

Return value

The client program's implementation of the OnUpdate method should return one of the following HRESULT values to the caller.

Return code Description
The method completed successfully.
The value of one of the input parameters is invalid.


Do not call Release on the query object from this method. Doing so could cause a deadlock. If Release is called on a query object from another thread while a callback is in process, the object will not be released until the callback has finished.

All notifications passed to Function Discovery by providers are queued and returned to the client one by one. Callbacks are synchronized so that a client will only receive one notification at a time.

Because other IFunctionDiscoveryNotification method calls may be made in other threads, any changes made to the thread state during the call must be restored before exiting the method.


The following code shows an OnUpdate handler implementation. The CMyNotificationListener class is defined in the IFunctionDiscoveryNotification topic.

#include <windows.h>

HRESULT STDMETHODCALLTYPE CMyNotificationListener::OnUpdate(
                                          IN QueryUpdateAction Action,
                                          IN FDQUERYCONTEXT fdqcQueryContext,
                                          IN IFunctionInstance *pInstance)
    HRESULT hr = S_OK;

    switch (Action) {
    case QUA_ADD:
        SetEvent( m_hAddEvent );
    case QUA_REMOVE:
        SetEvent( m_hRemoveEvent );
    case QUA_CHANGE:
        SetEvent( m_hChangeEvent );
    return S_OK;


Minimum supported client Windows Vista [desktop apps only]
Minimum supported server Windows Server 2008 [desktop apps only]
Target Platform Windows
Header functiondiscoveryapi.h

See also