Share via


IUPnPDeviceFinder::CreateAsyncFind (Windows Embedded CE 6.0)

1/6/2010

This method creates an asynchronous search operation.

Syntax

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 Value

  • 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:IDispatchinterface, 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 IUPnPDevice object of the new device; it is only valid when param3 is 0.
  • param2 is the unique device name (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 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

Header upnp.h
Library uuid.lib
Windows Embedded CE Windows CE .NET 4.0 and later

See Also

Reference

IUPnPDeviceFinder
IUPnPDevice
IUPnPDeviceFinder::StartAsyncFind