共用方式為


FreePortableDevicePnPIDs 函式

FreePortableDevicePnPIDs協助程式函式會釋放IPortableDeviceManager::GetDevicesIPortableDeviceServiceManager::GetDeviceServiceManager::GetDeviceServices方法所擷取的 隨插即用 (PnP) 識別碼。

語法

void FreePortableDevicePnPIDs(
   LPWSTR *pPnPIDs,
   DWORD  cPnPIDs
);

參數

pPnPIDs

要釋放的 PnP) 識別碼隨插即用 (陣列。

cPnPIDs

pPnPIDs參數所指定陣列中的識別碼數目。

傳回值

此函式不會傳回值。

備註

應用程式負責釋放其配置的指標陣列。

範例

// 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;      
 }
} 

規格需求

需求
最低支援的用戶端
Windows 7 [傳統型應用程式 |UWP 應用程式]
最低支援的伺服器
都不支援
標頭
PortableDevice.h