【发布时间】:2017-12-20 15:04:49
【问题描述】:
我想通过 IPortableDeviceValues 获取 WPD 上图像文件的宽度和高度。
根据Windows Dev Center,每个类型为 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 我找不到这个错误代码here
有谁知道怎么回事?
【问题讨论】: