Bewerken

Delen via


Creating the Device Finder

The following examples demonstrate how to create an instance of the Device Finder object in C++, Visual Basic, and VBScript. The script languages use the programmatic ID (ProgID) UPnP.UPnPDeviceFinder to identify the Device Finder class. The C++ code uses the class identifier.

C++ Example

HRESULT hr = S_OK;
IUPnPDeviceFinder *pDeviceFinder = NULL;

hr = CoCreateInstance(CLSID_UPnPDeviceFinder, 
                      NULL,
                      CLSCTX_INPROC_SERVER,
                      IID_IUPnPDeviceFinder,
                      (void **) &pDeviceFinder);

As this C++ example indicates, the Device Finder object exposes a default interface, IUPnPDeviceFinder. The methods of this interface perform searches according to the valid search criteria for a UPnP-based device. This interface is Automation capable, so its methods can be called by scripting code.

VBScript Example

Dim deviceFinder

Set deviceFinder = CreateObject( "UPnP.UPnPDeviceFinder" )