IUPnPDeviceFinder::CreateAsyncFind

This method creates an asynchronous search operation.

HRESULT CreateAsyncFind(
  BSTR bstrTypeURI,
  DWORD dwFlags,
  IUnknown* punkDeviceFinderCallback,
  LONG* plFindData
);

Parameters

  • bstrTypeURI
    [in] Specifies the uniform resource identifier (URI) for which to search.
  • dwFlags
    [in] Specify 0. This parameter is reserved for future use.
  • punkDeviceFinderCallback
    [in] Reference to an IUnknown that specifies the callback UPnP uses to notify the caller when the search is complete.
  • plFindData
    [out] Receives a reference to a LONG that receives the identifier for this particular search. The application must supply this identifier to other asynchronous search methods that are called.

Return Values

  • S_OK
    This method was successful.

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

Remarks

This method returns immediately; UPnP notifies the caller of any search results using the callback specified by punkDeviceFinderCallback. This method returns a search identifier; the caller must use the IUPnPDeviceFinder::StartAsyncFind to actually begin the search.

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

The callback function must be declared with three parameters, and uses the values specified for each parameter:

  • param1 is the Device object of the new device; it is only valid when param3 is 0.

  • param2 is the UDN of the found or removed device; it is only valid when param3 is 0 or 1.

  • param3 is the type of callback. Valid values are:

    0 – indicates a new device,

    1 – indicates a device has been removed,

    2 – indicates that all devices that are currently on the network have been reported. The asynchronous search will continue until it is canceled and will report any device that appears on the network at a later time.

Requirements

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

See Also

IUPnPDeviceFinder:IDispatch | IUPnPDeviceFinder::StartAsyncFind

 Last updated on Saturday, April 10, 2004

© 1992-2003 Microsoft Corporation. All rights reserved.