Important:
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.
A version of this page is also available for
4/8/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 IUnknownthat specifies the callback UPnP uses to notify the caller when the search is complete.

plFindData

[out] Receives a reference to a LONGthat 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::StartAsyncFindto actually begin the search.

The object referred to by pUnkCallbackmust either support the IUPnPDeviceFinderCallback:IDispatchinterface, or the IDispatchinterface. The IUPnPDeviceFinder::CreateAsyncFindmethod first queries pUnkCallbackfor the IUPnPDeviceFinderCallback:IDispatchinterface. If this interface is not supported, the IUPnPDeviceFinder::CreateAsyncFindmethod then queries pUnkCallbackfor the IDispatchinterface. If the IDispatchinterface is not supported, both checks have failed and the IUPnPDeviceFinder::CreateAsyncFindmethod returns E_FAIL.

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

  • param1is the IUPnPDeviceobject of the new device; it is only valid when param3is 0.

  • param2is the unique device name (UDN) of the found or removed device; it is only valid when param3is 0 or 1.

  • param3is 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
Windows Mobile Windows Mobile Version 5.0 and later

See Also