FreePortableDevicePnPIDs function
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
);
Parameters
-
pPnPIDs
-
The array of Plug and Play (PnP) identifiers to be freed.
-
cPnPIDs
-
The number of identifiers in the array specified by the pPnPIDs parameter.
Return value
This function does not return a value.
Remarks
The application is responsible for freeing the array of pointers that it allocates.
Examples
// 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
Requirement | Value |
---|---|
Minimum supported client |
Windows 7 [desktop apps | UWP apps] |
Minimum supported server |
None supported |
Header |
|