本文整理汇总了C++中LPDATAOBJECT::QueryInterface方法的典型用法代码示例。如果您正苦于以下问题:C++ LPDATAOBJECT::QueryInterface方法的具体用法?C++ LPDATAOBJECT::QueryInterface怎么用?C++ LPDATAOBJECT::QueryInterface使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LPDATAOBJECT
的用法示例。
在下文中一共展示了LPDATAOBJECT::QueryInterface方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Initialize
STDMETHODIMP CShellExt::Initialize (LPCITEMIDLIST pidlFolder,
LPDATAOBJECT lpdobj,
HKEY hkeyProgID)
{
UNREFERENCED_PARAMETER(pidlFolder);
UNREFERENCED_PARAMETER(hkeyProgID);
LONG lType = 0;
HRESULT hr = NOERROR;
if (!lpdobj)
{
return E_INVALIDARG;
}
// For singular selections, the WIA namespace should always provide a
// dataobject that also supports IWiaItem
if (FAILED(lpdobj->QueryInterface (IID_IWiaItem, reinterpret_cast<LPVOID*>(&m_pItem))))
{
// failing that, get the list of selected items from the data object
UINT uItems = 0;
LPWSTR szName;
LPWSTR szToken;
szName = GetNamesFromDataObject (lpdobj, &uItems);
// we only support singular objects
if (uItems != 1)
{
hr = E_FAIL;
}
else
{
// The name is of this format: <device id>::<item name>
szToken = wcstok (szName, L":");
if (!szToken)
{
hr = E_FAIL;
}
// Our extension only supports root items, so make sure there's no item
// name
else if (wcstok (NULL, L":"))
{
hr = E_FAIL;
}
else
{
hr = CreateDeviceFromId (szToken, &m_pItem);
}
}
if (szName)
{
delete [] szName;
}
}
if (SUCCEEDED(hr))
{
m_pItem->GetItemType (&lType);
if (!(lType & WiaItemTypeRoot))
{
hr = E_FAIL; // we only support changing the property on the root item
}
}
return hr;
}