IUPnPService::AddCallback

This method registers an application's callback with UPnP.

HRESULT AddCallback(
  IUnknown* pUnkCallback
);

Parameters

  • pUnkCallback
    [in] Specifies the reference to the interface that contains the callback to register.

Return Values

  • S_OK
    This method was successful.

Otherwise, the method returns one of the COM error codes defined in WinError.h.

Remarks

When the first callback is registered for a given service, the control point is subscribing to an event from the device. The device will send the first event with the current values of all of the variables.

Do not call this method from within a callback.

If more than one callback is registered, UPnP invokes the callbacks sequentially.

The object referred to by pUnkCallback must either support the IUPnPServiceCallback:IDispatchinterface, or the IDispatch interface. The IUPnPService::AddCallback method first queries pUnkCallback for the IUPnPServiceCallback interface. If this interface is not supported, the IUPnPService::AddCallback method then queries pUnkCallback for the IDispatch interface. If the IDispatch interface is not supported, both checks have failed and the IUPnPService::AddCallback method returns E_FAIL.

If only IDispatch is supported, the Service object invokes the callback by calling IDispatch::Invoke, which indicates the default method. This default IDispatch method is passed the same parameters as the IUPnPServiceCallback method, but the first parameter passed is a string that indicates the reason the callback is invoked. Valid values are VARIABLE_UPDATE and SERVICE_INSTANCE_DIED.

Requirements

OS Versions: Windows CE .NET 4.0 and later.
Header: Upnp.h.
Link Library: Uuid.lib.

See Also

IUPnPService:IDispatch | IUPnPServiceCallback:IDispatch

 Last updated on Saturday, April 10, 2004

© 1992-2003 Microsoft Corporation. All rights reserved.