我想通过 IPortableDeviceValues 获取 WPD 上图像文件的宽度和高度。
根据Windows 开发中心,每个类型为 WPD_CONTENT_TYPE_IMAGE 的对象(它们是)都需要提供 WPD_MEDIA_WIDTH/WPD_MEDIA_HEIGHT 但我总是收到错误消息。
HRESULT MyPortableDevice::getIntValue(IPortableDeviceProperties* properties, PCWSTR objectID, const PROPERTYKEY& key, DWORD* value)
{
ComPtr<IPortableDeviceValues> objectProperties;
ComPtr<IPortableDeviceKeyCollection> propertiesToRead;
HRESULT hr = CoCreateInstance(CLSID_PortableDeviceKeyCollection,
nullptr,
CLSCTX_INPROC_SERVER,
IID_PPV_ARGS(&propertiesToRead));
if (SUCCEEDED(hr)) {
HRESULT tempHr = S_OK;
tempHr = propertiesToRead->Add(key);
}
if (SUCCEEDED(hr)) {
hr = properties->GetValues(objectID,
propertiesToRead.Get(),
&objectProperties);
}
if (SUCCEEDED(hr)) {
ULONG intValue = 0;
hr = objectProperties->GetUnsignedIntegerValue(key, &intValue);
if (SUCCEEDED(hr)) {
value = &intValue;
intValue = 0;
}
}
return hr;
我总是从
hr = objectProperties->GetUnsignedIntegerValue(key, &intValue);
hr = 0x80070490 我在这里找不到这个错误代码
有谁知道出了什么问题?