FreePortableDevicePnPIDs-Funktion

The FreePortableDevicePnPIDs helper function frees the Plug and Play (PnP) identifiers that are retrieved by the IPortableDeviceManager::GetDevices or IPortableDeviceServiceManager::GetDeviceServices methods.

Syntax

void FreePortableDevicePnPIDs(
   LPWSTR *pPnPIDs,
   DWORD  cPnPIDs
);

Parameter

pPnPIDs

Das Array von PnP-Bezeichnern (Plug & Play), die freigegeben werden sollen.

cPnPIDs

Die Anzahl der Bezeichner im Array, die durch den pPnPIDs-Parameter angegeben werden.

Rückgabewert

Diese Funktion gibt keinen Wert zurück.

Bemerkungen

Die Anwendung ist für das Freigeben des Arrays von Zeigern verantwortlich, die sie zuordnet.

Beispiele

// Allocate an array of LPWSTR pointers.
    LPWSTR* pPnpDeviceIDs = new LPWSTR[cPnpDeviceIDs];
if (pPnpDeviceIDs != NULL)
{
    hr = pPortableDeviceManager->;GetDevices(pPnpDeviceIDs, &cPnpDeviceIDs);
    if (SUCCEEDED(hr))
    {
        // Free all returned PnPDeviceID strings allocated by IPortableDeviceManager::GetDevices.
     FreePortableDevicePnPIDs(pPnpDeviceIDs, cPnpDeviceIDs);
     // Application is responsible for deleting the array of LPWSTR pointers.
     delete [] pPnpDeviceIDs;
     pPnpDeviceIDs = NULL;      
 }
} 

Requirements (Anforderungen)

Anforderung Wert
Unterstützte Mindestversion (Client)
UWP-Apps für Windows 7 [ | Desktop-Apps]
Unterstützte Mindestversion (Server)
Nicht unterstützt
Header
PortableDevice.h