Notitie
Voor toegang tot deze pagina is autorisatie vereist. U kunt proberen u aan te melden of de directory te wijzigen.
Voor toegang tot deze pagina is autorisatie vereist. U kunt proberen de mappen te wijzigen.
Wanneer een WPD-toepassing de methode IPortableDeviceCapabilities::GetSupportedFormatProperties methode aanroept, activeert deze methode op zijn beurt een aanroep naar de WpdCapabilities::OnGetSupportedFormatProperties methode in het voorbeeldstuurprogramma. Met de laatste methode wordt een IPortableDeviceKeyCollection object gemaakt waarin het stuurprogramma de eigenschappen opslaat die het ondersteunt voor objecten van een bepaalde indeling.
HRESULT WpdCapabilities::OnGetSupportedFormatProperties(
IPortableDeviceValues* pParams,
IPortableDeviceValues* pResults)
{
HRESULT hr = S_OK;
GUID guidObjectFormat = GUID_NULL;
CComPtr<IPortableDeviceKeyCollection> pKeys;
// First get ALL parameters for this command. If we cannot get ALL parameters
// then E_INVALIDARG should be returned and no further processing should occur.
// Get the object format whose supported properties have been requested
if (hr == S_OK)
{
hr = pParams->GetGuidValue(WPD_PROPERTY_CAPABILITIES_FORMAT, &guidObjectFormat);
CHECK_HR(hr, "Missing value for WPD_PROPERTY_CAPABILITIES_FORMAT");
}
// CoCreate a collection to store the supported properties.
if (hr == S_OK)
{
hr = CoCreateInstance(CLSID_PortableDeviceKeyCollection,
NULL,
CLSCTX_INPROC_SERVER,
IID_IPortableDeviceKeyCollection,
(VOID**) &pKeys);
CHECK_HR(hr, "Failed to CoCreate CLSID_PortableDeviceKeyCollection");
}
// Add the supported properties for the specified object format to the collection.
if (hr == S_OK)
{
hr = AddSupportedPropertyKeys(guidObjectFormat, pKeys);
CHECK_HR(hr, "Failed to get supported properties for a format");
}
// Set the WPD_PROPERTY_CAPABILITIES_PROPERTY_KEYS value in the results.
if (hr == S_OK)
{
hr = pResults->SetIPortableDeviceKeyCollectionValue(WPD_PROPERTY_CAPABILITIES_PROPERTY_KEYS, pKeys);
CHECK_HR(hr, "Failed to set WPD_PROPERTY_CAPABILITIES_PROPERTY_KEYS");
}
return hr;
}