本文整理匯總了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;
}