我想得到的宽度和高度的图像文件在一个可擦除通过IPortableDeviceValues。
根据Windows Dev Center,每个类型为WPD_CONTENT_TYPE_IMAGE的对象都需要提供WPD_WIDTH/WPD_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
有人知道哪里出问题了吗?
发布于 2018-01-17 20:52:09
您得到的错误是:错误代码:(HRESULT) 0x80070490 (2147943568) -找不到元素。
你得到这个错误的原因很可能是实际上手机应用程序开发人员通常只是忽略了一些属性。
我已经将我的手机连接到PC,并用WPD Information Tool查看了一些图像,但对于.jpg截图,我只能得到以下字段:

我认为在大多数情况下,你需要读取图片的内容来流式传输,并直接检查它的参数。也许在某些格式中,你只能读取一些“页眉”部分,并从中获得宽度和高度。
https://stackoverflow.com/questions/47908950
复制相似问题