当前位置: 首页>>代码示例>>C++>>正文


C++ IEnumVARIANT::Reset方法代码示例

本文整理汇总了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;
}
开发者ID:gsaralji,项目名称:TRiAS,代码行数:18,代码来源:EDBS_Linien.cpp

示例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();
	}
}
开发者ID:watfordxp,项目名称:MikeNet,代码行数:47,代码来源:UpnpNatAction.cpp

示例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))
//.........这里部分代码省略.........
开发者ID:Ippei-Murofushi,项目名称:WindowsSDK7-Samples,代码行数:101,代码来源:EraseTest.cpp


注:本文中的IEnumVARIANT::Reset方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。