本文整理汇总了C++中IEnumVARIANT::Reset方法的典型用法代码示例。如果您正苦于以下问题:C++ IEnumVARIANT::Reset方法的具体用法?C++ IEnumVARIANT::Reset怎么用?C++ IEnumVARIANT::Reset使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IEnumVARIANT
的用法示例。
在下文中一共展示了IEnumVARIANT::Reset方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: get__NewEnum
STDMETHODIMP CEDBS_Linien::get__NewEnum(IUnknown **pVal)
{
AFX_MANAGE_STATE(AfxGetStaticModuleState())
HRESULT hResult;
CComObject<CEDBS_LinienENUM> *pobjENUM;
IEnumVARIANT *pIENUM;
hResult = CComObject<CEDBS_LinienENUM>::CreateInstance(&pobjENUM);
pobjENUM->mpobjsLinien = this;
hResult = pobjENUM->QueryInterface(IID_IUnknown,(void**)pVal);
pIENUM = NULL;
hResult = pobjENUM->QueryInterface(IID_IEnumVARIANT,(void**)&pIENUM);
pIENUM->Reset();
return S_OK;
}
示例2: UpdateInfo
/**
* @brief Updates information about port maps on router.
*/
void UpnpNatAction::UpdateInfo()
{
HRESULT hResult;
// Cleanup old port map in case this is an update
CleanPortMaps();
// Retrieve current port mappings
hResult = nat->get_StaticPortMappingCollection(&portMapCollection);
_ErrorException((hResult != S_OK), "retrieving current port mappings (!= S_OK)", hResult, __LINE__, __FILE__);
_ErrorException((portMapCollection == NULL), "retrieving current port mappings (NULL)", NULL, __LINE__, __FILE__);
// Scan through list and load port maps into vector
// Code is based on MSDN sample
IUnknown * ptrUnk = NULL;
hResult = portMapCollection->get__NewEnum(&ptrUnk);
if (SUCCEEDED(hResult))
{
IEnumVARIANT * ptrEnumVar = NULL;
hResult = ptrUnk->QueryInterface(IID_IEnumVARIANT, (void **) &ptrEnumVar);
if (SUCCEEDED(hResult))
{
VARIANT varCurDevice;
VariantInit(&varCurDevice);
ptrEnumVar->Reset();
// Loop through each port map in the collection
while (S_OK == ptrEnumVar->Next(1, &varCurDevice, NULL))
{
IStaticPortMapping * ptrPortMap = NULL;
IDispatch * pdispDevice = V_DISPATCH(&varCurDevice);
if (SUCCEEDED(pdispDevice->QueryInterface(IID_IStaticPortMapping, (void **) &ptrPortMap)))
{
// Add port map to vector
UpnpNatPortMapAction * newPortMap = new (nothrow)UpnpNatPortMapAction(ptrPortMap);
Utility::DynamicAllocCheck(newPortMap,__LINE__,__FILE__);
portMaps.Add(newPortMap);
}
VariantClear(&varCurDevice);
}
ptrEnumVar->Release();
}
ptrUnk->Release();
}
}
示例3: if
BOOLEAN
GetParameters(
IN DWORD Count,
IN WCHAR* Arguments[],
OUT IDiscRecorder2** Recorder,
OUT VARIANT_BOOL* FullErase
)
{
BOOLEAN validArgument = TRUE;
if ((Count < 1) || (Count > 2))
{
validArgument = FALSE;
}
if (validArgument && (Arguments[0][1] != ':'))
{
validArgument = FALSE;
}
if (validArgument && (Count == 2))
{
if ( _wcsnicmp(Arguments[1], (L"-fullerase"), strlen("-fullerase")) == 0 )
{
*FullErase = VARIANT_TRUE;
}
else
{
validArgument = FALSE;
}
}
//Try to retrieve the recorder.
if (validArgument)
{
HRESULT hr = S_OK;
IDiscMaster2* tmpDiscMaster = NULL;
IEnumVARIANT* tmpRecorderEnumerator = NULL;
IDiscRecorder2* tmpRecorder = NULL;
VARIANT tmpUniqueId;
BOOLEAN recorderFound = FALSE;
// create the disc master object
if (SUCCEEDED(hr))
{
hr = CoCreateInstance(CLSID_MsftDiscMaster2,
NULL,
CLSCTX_ALL,
IID_PPV_ARGS(&tmpDiscMaster)
);
if (FAILED(hr))
{
printf("Failed to Create DiscMaster. Error: 0x%X.\n", hr);
}
}
// get a new enumerator for the disc recorders
if (SUCCEEDED(hr))
{
hr = tmpDiscMaster->get__NewEnum(&tmpRecorderEnumerator);
if (FAILED(hr))
{
printf("Failed get__NewEnum. Error: 0x%X.\n", hr);
}
}
// Reset the enumerator to the beginning
if (SUCCEEDED(hr))
{
hr = tmpRecorderEnumerator->Reset();
if (FAILED(hr))
{
printf("Failed to reset enumerator. Error: 0x%X.\n", hr);
}
}
// request just that one recorder's BSTR
if (SUCCEEDED(hr))
{
while (SUCCEEDED(hr) && !recorderFound)
{
hr = tmpRecorderEnumerator->Next(1, &tmpUniqueId, NULL);
if (SUCCEEDED(hr))
{
// Create a new IDiscRecorder2
hr = CoCreateInstance(CLSID_MsftDiscRecorder2,
NULL,
CLSCTX_ALL,
IID_PPV_ARGS(&tmpRecorder)
);
if (FAILED(hr))
{
printf("Failed CoCreateInstance for DiscRecorder. Error: 0x%X.\n", hr);
}
// Initialize it with the provided BSTR
if (SUCCEEDED(hr))
{
hr = tmpRecorder->InitializeDiscRecorder(tmpUniqueId.bstrVal);
if (FAILED(hr))
//.........这里部分代码省略.........