Notes
L’accès à cette page nécessite une autorisation. Vous pouvez essayer de vous connecter ou de modifier des répertoires.
L’accès à cette page nécessite une autorisation. Vous pouvez essayer de modifier des répertoires.
Les fichiers WpdCapabilities.cpp et WpdCapabilities.h contiennent les gestionnaires de commandes qui récupèrent les commandes prises en charge, les options de commande, les catégories de fonctions, etc.
Lorsqu’une application Windows appelle l’une des méthodes de l’interface IPortableDeviceCapabilities, cet appel déclenche à son tour l’un des huit gestionnaires de commandes de la classe WpdCapabilities. Le tableau suivant identifie le mappage des méthodes IPortableDeviceCapabilities vers les gestionnaires de commandes WpdCapabilities.
méthode IPortableDeviceCapabilities: Gestionnaire d’événements WpdCapabilities
IPortableDeviceCapabilities::GetCommandOptions : OnGetCommandOptions
IPortableDeviceCapabilities::GetFixedPropertyAttributes : OnGetFixedPropertyAttributes
IPortableDeviceCapabilities::GetFunctionalCategories : OnGetFunctionalCategories
IPortableDeviceCapabilities::GetFunctionalObjects : OnGetFunctionalObjects
IPortableDeviceCapabilities::GetSupportedCommands : OnGetSupportedCommands
IPortableDeviceCapabilities::GetSupportedContentTypes : OnGetSupportedContentTypes
IPortableDeviceCapabilities::GetSupportedFormatProperties : OnGetSupportedFormatProperties
IPortableDeviceCapabilities::GetSupportedFormats : OnGetSupportedFormats
IPortableDeviceCapabilities::GetSupportedEvents : OnGetSupportedEvents
IPortableDeviceCapabilities::GetEventOptions : OnGetEventOptions
Les gestionnaires de commandes WpdCapabilities sont invoqués par la méthode WpdCapabilities::DispatchMessage. L'extrait suivant de l'exemple de pilote contient le code de WpdCapabilities::DispatchMessage.
HRESULT WpdCapabilities::DispatchWpdMessage(const PROPERTYKEY& Command,
IPortableDeviceValues* pParams,
IPortableDeviceValues* pResults)
{
HRESULT hr = S_OK;
if (hr == S_OK)
{
if (Command.fmtid != WPD_CATEGORY_CAPABILITIES)
{
hr = E_INVALIDARG;
CHECK_HR(hr, "This object does not support this command category %ws",CComBSTR(Command.fmtid));
}
}
if (hr == S_OK)
{
if (IsEqualPropertyKey(Command, WPD_COMMAND_CAPABILITIES_GET_SUPPORTED_COMMANDS))
{
hr = OnGetSupportedCommands(pParams, pResults);
CHECK_HR(hr, "Failed to get supported commands");
}
else if (IsEqualPropertyKey(Command, WPD_COMMAND_CAPABILITIES_GET_COMMAND_OPTIONS))
{
hr = OnGetCommandOptions(pParams, pResults);
CHECK_HR(hr, "Failed to get command options");
}
else if (IsEqualPropertyKey(Command, WPD_COMMAND_CAPABILITIES_GET_SUPPORTED_FUNCTIONAL_CATEGORIES))
{
hr = OnGetFunctionalCategories(pParams, pResults);
CHECK_HR(hr, "Failed to get functional categories");
}
else if (IsEqualPropertyKey(Command, WPD_COMMAND_CAPABILITIES_GET_FUNCTIONAL_OBJECTS))
{
hr = OnGetFunctionalObjects(pParams, pResults);
CHECK_HR(hr, "Failed to get functional objects");
}
else if (IsEqualPropertyKey(Command, WPD_COMMAND_CAPABILITIES_GET_SUPPORTED_CONTENT_TYPES))
{
hr = OnGetSupportedContentTypes(pParams, pResults);
CHECK_HR(hr, "Failed to get supported content types");
}
else if (IsEqualPropertyKey(Command, WPD_COMMAND_CAPABILITIES_GET_SUPPORTED_FORMATS))
{
hr = OnGetSupportedFormats(pParams, pResults);
CHECK_HR(hr, "Failed to get supported formats");
}
else if (IsEqualPropertyKey(Command, WPD_COMMAND_CAPABILITIES_GET_SUPPORTED_FORMAT_PROPERTIES))
{
hr = OnGetSupportedFormatProperties(pParams, pResults);
CHECK_HR(hr, "Failed to get supported format properties");
}
else if (IsEqualPropertyKey(Command, WPD_COMMAND_CAPABILITIES_GET_FIXED_PROPERTY_ATTRIBUTES))
{
hr = OnGetFixedPropertyAttributes(pParams, pResults);
CHECK_HR(hr, "Failed to get fixed property attributes");
}
else if (IsEqualPropertyKey(Command, WPD_COMMAND_CAPABILITIES_GET_SUPPORTED_EVENTS))
{
hr = OnGetSupportedEvents(pParams, pResults);
CHECK_HR(hr, "Failed to get supported events");
}
else if (IsEqualPropertyKey(Command, WPD_COMMAND_CAPABILITIES_GET_EVENT_OPTIONS))
{
hr = OnGetEventOptions(pParams, pResults);
CHECK_HR(hr, "Failed to get event options");
}
else
{
hr = E_NOTIMPL;
CHECK_HR(hr, "This object does not support this command id %d", Command.pid);
}
}
return hr;
}