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


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

本文整理汇总了C++中IEnumMoniker::Reset方法的典型用法代码示例。如果您正苦于以下问题:C++ IEnumMoniker::Reset方法的具体用法?C++ IEnumMoniker::Reset怎么用?C++ IEnumMoniker::Reset使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IEnumMoniker的用法示例。


在下文中一共展示了IEnumMoniker::Reset方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: ds

QList<QByteArray> QAudioDeviceInfoInternal::availableDevices(QAudio::Mode mode)
{
    Q_UNUSED(mode)

    QList<QByteArray> devices;
    //enumerate device fullnames through directshow api
    CoInitialize(NULL);
    ICreateDevEnum *pDevEnum = NULL;
    IEnumMoniker *pEnum = NULL;
    // Create the System device enumerator
    HRESULT hr = CoCreateInstance(CLSID_SystemDeviceEnum, NULL,
                 CLSCTX_INPROC_SERVER, IID_ICreateDevEnum,
                 reinterpret_cast<void **>(&pDevEnum));

    unsigned long iNumDevs = mode == QAudio::AudioOutput ? waveOutGetNumDevs() : waveInGetNumDevs();
    if (SUCCEEDED(hr)) {
        // Create the enumerator for the audio input/output category
        if (pDevEnum->CreateClassEnumerator(
             mode == QAudio::AudioOutput ? CLSID_AudioRendererCategory : CLSID_AudioInputDeviceCategory,
             &pEnum, 0) == S_OK) {
            pEnum->Reset();
            // go through and find all audio devices
            IMoniker *pMoniker = NULL;
            while (pEnum->Next(1, &pMoniker, NULL) == S_OK) {
                IPropertyBag *pPropBag;
                hr = pMoniker->BindToStorage(0,0,IID_IPropertyBag,
                     reinterpret_cast<void **>(&pPropBag));
                if (FAILED(hr)) {
                    pMoniker->Release();
                    continue; // skip this one
                }
                // Find if it is a wave device
                VARIANT var;
                VariantInit(&var);
                hr = pPropBag->Read(mode == QAudio::AudioOutput ? L"WaveOutID" : L"WaveInID", &var, 0);
                if (SUCCEEDED(hr)) {
                    LONG waveID = var.lVal;
                    if (waveID >= 0 && waveID < LONG(iNumDevs)) {
                        VariantClear(&var);
                        // Find the description
                        hr = pPropBag->Read(L"FriendlyName", &var, 0);
                        if (SUCCEEDED(hr)) {
                            QByteArray  device;
                            QDataStream ds(&device, QIODevice::WriteOnly);
                            ds << quint32(waveID) << QString::fromWCharArray(var.bstrVal);
                            devices.append(device);
                        }
                    }
                }

                pPropBag->Release();
                pMoniker->Release();
            }
        }
    }
    CoUninitialize();

    return devices;
}
开发者ID:,项目名称:,代码行数:59,代码来源:

示例2: temp

QT_BEGIN_NAMESPACE

DSVideoDeviceControl::DSVideoDeviceControl(QObject *parent)
    : QVideoDeviceControl(parent)
{
    m_session = qobject_cast<DSCameraSession*>(parent);

    devices.clear();
    descriptions.clear();

    CoInitialize(NULL);
    ICreateDevEnum* pDevEnum = NULL;
    IEnumMoniker* pEnum = NULL;
    // Create the System device enumerator
    HRESULT hr = CoCreateInstance(CLSID_SystemDeviceEnum, NULL,
            CLSCTX_INPROC_SERVER, IID_ICreateDevEnum,
            reinterpret_cast<void**>(&pDevEnum));
    if(SUCCEEDED(hr)) {
        // Create the enumerator for the video capture category
        hr = pDevEnum->CreateClassEnumerator(
                CLSID_VideoInputDeviceCategory, &pEnum, 0);
        if (S_OK == hr) {
            pEnum->Reset();
            // go through and find all video capture devices
            IMoniker* pMoniker = NULL;
            while(pEnum->Next(1, &pMoniker, NULL) == S_OK) {
                IPropertyBag *pPropBag;
                hr = pMoniker->BindToStorage(0, 0, IID_IPropertyBag,
                        (void**)(&pPropBag));
                if(FAILED(hr)) {
                    pMoniker->Release();
                    continue; // skip this one
                }
                // Find the description
                WCHAR str[120];
                VARIANT varName;
                varName.vt = VT_BSTR;
                hr = pPropBag->Read(L"FriendlyName", &varName, 0);
                if(SUCCEEDED(hr)) {
                    wcsncpy(str, varName.bstrVal, sizeof(str)/sizeof(str[0]));
                    QString temp(QString::fromUtf16((unsigned short*)str));
                    devices.append(QString("ds:%1").arg(temp).toLocal8Bit().constData());
                    hr = pPropBag->Read(L"Description", &varName, 0);
                    wcsncpy(str, varName.bstrVal, sizeof(str)/sizeof(str[0]));
                    QString temp2(QString::fromUtf16((unsigned short*)str));
                    descriptions.append(temp2.toLocal8Bit().constData());
                }
                pPropBag->Release();
                pMoniker->Release();
            }
            pEnum->Release();
        }
        pDevEnum->Release();
    }
    CoUninitialize();

    selected = 0;
}
开发者ID:Esclapion,项目名称:qt-mobility,代码行数:58,代码来源:dsvideodevicecontrol.cpp

示例3: updateDevices

void DSServicePlugin::updateDevices() const
{
    m_cameraDevices.clear();
    m_cameraDescriptions.clear();
    BOOL bFound = TRUE;
    CoInitialize(NULL);
    ICreateDevEnum* pDevEnum = NULL;
    IEnumMoniker* pEnum = NULL;
    // Create the System device enumerator
    HRESULT hr = CoCreateInstance(CLSID_SystemDeviceEnum, NULL,
                 CLSCTX_INPROC_SERVER, IID_ICreateDevEnum,
		 reinterpret_cast<void**>(&pDevEnum));
    if(SUCCEEDED(hr)) {
        // Create the enumerator for the video capture category
	hr = pDevEnum->CreateClassEnumerator(
	     CLSID_VideoInputDeviceCategory, &pEnum, 0);
        if (S_OK == hr) {
            pEnum->Reset();
            // go through and find all video capture devices
            IMoniker* pMoniker = NULL;
            while(pEnum->Next(1, &pMoniker, NULL) == S_OK) {
                IPropertyBag *pPropBag;
                hr = pMoniker->BindToStorage(0,0,IID_IPropertyBag,
                     (void**)(&pPropBag));
                if(FAILED(hr)) {
                    pMoniker->Release();
                    continue; // skip this one
                }
                bFound = TRUE;
                // Find the description
                WCHAR str[120];
                VARIANT varName;
                varName.vt = VT_BSTR;
                hr = pPropBag->Read(L"FriendlyName", &varName, 0);
                if(SUCCEEDED(hr)) {
                    wcsncpy(str, varName.bstrVal, sizeof(str)/sizeof(str[0]));
                    QString temp(QString::fromUtf16((unsigned short*)str));
                    m_cameraDevices.append(QString("ds:%1").arg(temp).toLocal8Bit().constData());
                    hr = pPropBag->Read(L"Description", &varName, 0);
                    wcsncpy(str, varName.bstrVal, sizeof(str)/sizeof(str[0]));
                    QString temp2(QString::fromUtf16((unsigned short*)str));
                    m_cameraDescriptions.append(temp2);
                } else {
                    qWarning() << "No friendly name";
                }
                pPropBag->Release();
                pMoniker->Release();
            }
            pEnum->Release();
        }
        pDevEnum->Release();
    }
    CoUninitialize();
    if (!bFound) {
        qWarning() << "No camera devices found";
    }
}
开发者ID:,项目名称:,代码行数:57,代码来源:

示例4: AccessVisualStudio

/** Accesses the correct visual studio instance if possible. */
bool AccessVisualStudio(CComPtr<EnvDTE::_DTE>& OutDTE, const FString& InSolutionPath, const TArray<FVSAccessorModule::VisualStudioLocation>& InLocations)
{
	bool bSuccess = false;

	// Open the Running Object Table (ROT)
	IRunningObjectTable* RunningObjectTable;
	if (SUCCEEDED(GetRunningObjectTable(0, &RunningObjectTable)) &&
		RunningObjectTable)
	{
		IEnumMoniker* MonikersTable;
		RunningObjectTable->EnumRunning(&MonikersTable);
		MonikersTable->Reset();

		// Look for all visual studio instances in the ROT
		IMoniker* CurrentMoniker;
		while (!bSuccess && MonikersTable->Next(1, &CurrentMoniker, NULL) == S_OK)
		{
			IBindCtx* BindContext;
			LPOLESTR OutName;
			CComPtr<IUnknown> ComObject;
			if (SUCCEEDED(CreateBindCtx(0, &BindContext)) &&
				SUCCEEDED(CurrentMoniker->GetDisplayName(BindContext, NULL, &OutName)) &&
				IsVisualStudioMoniker(FString(OutName), InLocations) &&
				SUCCEEDED(RunningObjectTable->GetObject(CurrentMoniker, &ComObject)))
			{
				CComPtr<EnvDTE::_DTE> TempDTE;
				TempDTE = ComObject;
				
				// Get the solution path for this instance
				// If it equals the solution we would have opened above in RunVisualStudio(), we'll take that
				CComPtr<EnvDTE::_Solution> Solution;
				LPOLESTR OutPath;
				if (SUCCEEDED(TempDTE->get_Solution(&Solution)) &&
					SUCCEEDED(Solution->get_FullName(&OutPath)))
				{
					FString Filename(OutPath);
					FPaths::NormalizeFilename(Filename);

					if( Filename == InSolutionPath )
					{
						OutDTE = TempDTE;
						bSuccess = true;
					}
				}
			}
			BindContext->Release();
			CurrentMoniker->Release();
		}
		MonikersTable->Release();
		RunningObjectTable->Release();
	}

	return bSuccess;
}
开发者ID:Tigrouzen,项目名称:UnrealEngine-4,代码行数:55,代码来源:VSAccessorModule.cpp

示例5: error

JNIEXPORT jlong JNICALL Java_com4j_Native_getEnumMoniker(JNIEnv* env, jclass __unused__, jlong rotPointer){
  IRunningObjectTable *rot = reinterpret_cast<IRunningObjectTable*>(rotPointer);
  IEnumMoniker *moniker;
  HRESULT hr = rot->EnumRunning(&moniker);
  if(hr != S_OK){
    error(env, __FILE__, __LINE__, hr, "IRunningObjectTable::EnumRunning failed");
    return 0;
  }
  moniker->Reset();
  return reinterpret_cast<jlong>(moniker);
}
开发者ID:Alcar32,项目名称:com4j,代码行数:11,代码来源:com4j.cpp

示例6: EnumDevices

//枚举设备
HRESULT CCaptureDevice::EnumDevices( REFCLSID clsidDeviceClass, ENUMCALLBACK pEnumCallBack, LPVOID lp )
{
	//创建枚举组件
    ICreateDevEnum *pCreateDevEnum;
	HRESULT hr;
	VARIANT var;
	hr = CoCreateInstance( CLSID_SystemDeviceEnum, NULL, CLSCTX_INPROC_SERVER,IID_ICreateDevEnum, (void**)&pCreateDevEnum );
	if( hr==S_OK )
	{
		//创建枚举器
		IEnumMoniker* pEm;
		hr = pCreateDevEnum->CreateClassEnumerator( clsidDeviceClass, &pEm, 0 );
		if( hr==S_OK )
		{
			if( pEm )
			{
				//复位
				pEm->Reset();

				//准备顺序找设备
				ULONG cFetched;
				IMoniker *pM;
				BOOL bCancel = false;
				int index = 0;
				while( !bCancel && (hr = pEm->Next(1, &pM, &cFetched), hr==S_OK) )
				{
					IPropertyBag *pBag;
					hr = pM->BindToStorage(0, 0, IID_IPropertyBag, (void **)&pBag);
					if(hr==S_OK)
					{
						ZeroMemory( &var, sizeof(var) );
						var.vt = VT_BSTR;
						hr = pBag->Read(L"FriendlyName", &var, NULL);
						if(hr==S_OK && var.bstrVal!=0 )
						{
							if(pEnumCallBack)
								hr = pEnumCallBack( index, &var, pM, lp, bCancel );
							SysFreeString(var.bstrVal);
						}
						pBag->Release();
					}
					pM->Release();
					index++;
				}

				//释放
				pEm->Release();
			}
		}
		pCreateDevEnum->Release();
	}
	return hr;
}
开发者ID:duzhi5368,项目名称:FKChessCards,代码行数:54,代码来源:CaptureDevice.cpp

示例7: EnlazarFiltro

bool Captura::EnlazarFiltro(int deviceId, IBaseFilter **pFilter)
{
	if (deviceId < 0)
		return false;

	//CComPtr<ICreateDevEnum> pCreateDevEnum;
    ICreateDevEnum *pCreateDevEnum;
    HRESULT hr = CoCreateInstance(CLSID_SystemDeviceEnum, NULL, CLSCTX_INPROC_SERVER,
			  IID_ICreateDevEnum, (void**)&pCreateDevEnum);
    if (hr != NOERROR)
	{

		return false;
	}

    //CComPtr<IEnumMoniker> pEm;
    IEnumMoniker *pEm;
    hr = pCreateDevEnum->CreateClassEnumerator(CLSID_VideoInputDeviceCategory,
								&pEm, 0);
    if (hr != NOERROR) 
	{
		return false;
    }

    pEm->Reset();
    ULONG cFetched;
    IMoniker *pM;
	int index = 0;
    while(hr = pEm->Next(1, &pM, &cFetched),  hr==S_OK,  index <= deviceId)
    {
		IPropertyBag *pBag;
		hr = pM->BindToStorage(0, 0, IID_IPropertyBag, (void **)&pBag);
		if(SUCCEEDED(hr)) 
		{
			VARIANT var;
			var.vt = VT_BSTR;
			hr = pBag->Read(L"FriendlyName", &var, NULL);
			if (hr == NOERROR) 
			{
				if (index == deviceId)
				{
					pM->BindToObject(0, 0, IID_IBaseFilter, (void**)pFilter);
				}
				SysFreeString(var.bstrVal);
			}
			pBag->Release();
		}
		pM->Release();
		index++;
    }
	return true;
}
开发者ID:BackupTheBerlios,项目名称:visionrobot,代码行数:52,代码来源:Captura.cpp

示例8: GetCaptureFilter

	HRESULT GetCaptureFilter(REFCLSID CLSID_DeviceCategory, LPCTSTR lpFriendlyName, void** ppCapture)
	{
		ICreateDevEnum *pCreateDevEnum = 0;
		HRESULT hr = CoCreateInstance(CLSID_SystemDeviceEnum
			, NULL
			, CLSCTX_INPROC_SERVER
			, IID_ICreateDevEnum
			, (void**)&pCreateDevEnum);
		if (FAILED(hr)) return hr;

		IEnumMoniker* pEnumMoniker = 0;
		hr = pCreateDevEnum->CreateClassEnumerator(CLSID_DeviceCategory, &pEnumMoniker, 0);
		if (FAILED(hr))
		{
			pCreateDevEnum->Release();
			return hr;
		}
		pEnumMoniker->Reset();

		BOOL bFound = FALSE;
		IMoniker* pMoniker = NULL;
		while ((pEnumMoniker->Next(1, &pMoniker, NULL) == S_OK )&& (!bFound))
		{
			IPropertyBag *pBag = NULL;
			hr = pMoniker->BindToStorage(0, 0, IID_IPropertyBag, (void **)&pBag);
			if (SUCCEEDED(hr))
			{
				VARIANT var = { 0 };
				var.vt = VT_BSTR;
				hr = pBag->Read(_T("FriendlyName"), &var, NULL);
				if (SUCCEEDED(hr))
				{
					if (!_tcscmp(var.bstrVal, lpFriendlyName))
					{
						hr = pMoniker->BindToObject(0, 0, IID_IBaseFilter, (void**)ppCapture);
						pMoniker->AddRef();
						bFound = TRUE;
					}
					pBag->Release();
				}
			}
			pMoniker->Release();
		}//end while
		pEnumMoniker->Release();
		pCreateDevEnum->Release();

		if (*ppCapture == NULL) return E_FAIL;
		if (FAILED(hr)) return hr;
		return bFound ? S_OK : S_FALSE;
	}
开发者ID:wyrover,项目名称:HiVideo2,代码行数:50,代码来源:DShowUtils.cpp

示例9: PyCom_BuildPyException

// @pymethod |PyIEnumMoniker|Reset|Resets the enumeration sequence to the beginning.
PyObject *PyIEnumMoniker::Reset(PyObject *self, PyObject *args)
{
	if (!PyArg_ParseTuple(args, ":Reset"))
		return NULL;

	IEnumMoniker *pMy = GetI(self);
	if (pMy==NULL) return NULL;

	PY_INTERFACE_PRECALL;
	HRESULT hr = pMy->Reset();
	PY_INTERFACE_POSTCALL;
	if (FAILED(hr))
		return PyCom_BuildPyException(hr);
	Py_INCREF(Py_None);
	return Py_None;
}
开发者ID:,项目名称:,代码行数:17,代码来源:

示例10: get_capture_device

IBaseFilter* get_capture_device(int device_num)
{
    ICreateDevEnum* createDeviceEnum;
    CoCreateInstance(CLSID_SystemDeviceEnum, 0,
					 CLSCTX_INPROC_SERVER,
					 IID_ICreateDevEnum,
					 (void**) &createDeviceEnum);

    if (createDeviceEnum == 0)
	{
        return 0;
	}

    IEnumMoniker* enumMoniker;
    createDeviceEnum->CreateClassEnumerator(CLSID_VideoInputDeviceCategory,
	                                        &enumMoniker, 0);
    if (enumMoniker == 0)
	{
		createDeviceEnum->Release();
        return 0;
	}

    enumMoniker->Reset();

    IBaseFilter* result = 0;
 
	int index = 0;
	IMoniker* moniker;
    while (enumMoniker->Next(1, &moniker, 0) == S_OK)
	{        
		if (index == device_num)
		{
			HRESULT bindToObjectResult =
				moniker->BindToObject(0, 0, IID_IBaseFilter, (void**) &result);
            break;
		}

		moniker->Release();
		++index;
    }

	enumMoniker->Release();
	createDeviceEnum->Release();
	
	return result;
}
开发者ID:ChristianFrisson,项目名称:gephex,代码行数:46,代码来源:dshowcapturedriver.cpp

示例11: EnumCaptures

	HRESULT EnumCaptures(REFCLSID CLSID_DeviceCategory, std::vector<TCaptureDevice>& refDeviceList)
	{
		refDeviceList.clear();

		ICreateDevEnum *pCreateDevEnum = 0;
		HRESULT hr = CoCreateInstance(CLSID_SystemDeviceEnum
			, NULL
			, CLSCTX_INPROC_SERVER
			, IID_ICreateDevEnum
			, (void**)&pCreateDevEnum);
		if (FAILED(hr)) return hr;

		IEnumMoniker* pEnumMoniker = 0;
		hr = pCreateDevEnum->CreateClassEnumerator(CLSID_DeviceCategory, &pEnumMoniker, 0);
		if (FAILED(hr))
		{
			pCreateDevEnum->Release();
			return hr;
		}
		pEnumMoniker->Reset();

		IMoniker* pMoniker = NULL;
		while (pEnumMoniker->Next(1, &pMoniker, NULL) == S_OK)
		{
			IPropertyBag *pBag = NULL;
			hr = pMoniker->BindToStorage(0, 0, IID_IPropertyBag, (void **)&pBag);
			if (SUCCEEDED(hr))
			{
				VARIANT var = { 0 };
				var.vt = VT_BSTR;
				hr = pBag->Read(_T("FriendlyName"), &var, NULL);
				if (SUCCEEDED(hr))
				{
					TCaptureDevice device;
					_tcscpy_s(device.szDeviceName, var.bstrVal);
					refDeviceList.push_back(device);
					pBag->Release();
				}
			}
			pMoniker->Release();
		}//end while

		pEnumMoniker->Release();
		pCreateDevEnum->Release();
		return hr;
	}
开发者ID:wyrover,项目名称:HiVideo2,代码行数:46,代码来源:DShowUtils.cpp

示例12: EnumDevices

/* 枚举本地系统的采集设备 */
int  CVMR_Capture::EnumDevices(HWND hList)
{
	if (!hList) return  -1;
	int id = 0;
    
	// enumerate all video capture devices
    ICreateDevEnum *pCreateDevEnum;
    HRESULT hr = CoCreateInstance(CLSID_SystemDeviceEnum, NULL, 
						CLSCTX_INPROC_SERVER,
						IID_ICreateDevEnum, (void**)&pCreateDevEnum);
    if (hr != NOERROR) return -1;
	
	IEnumMoniker *pEm;
    hr = pCreateDevEnum->CreateClassEnumerator(CLSID_VideoInputDeviceCategory, &pEm, 0);
    if (hr != NOERROR) return -1;

    pEm->Reset();
    ULONG cFetched;
    IMoniker *pM;
    while(hr = pEm->Next(1, &pM, &cFetched), hr==S_OK)
    {
		IPropertyBag *pBag;
		hr = pM->BindToStorage(0, 0, IID_IPropertyBag, (void **)&pBag);
		if(SUCCEEDED(hr)) 
		{
			VARIANT var;
			var.vt = VT_BSTR;
			hr = pBag->Read(L"FriendlyName", &var, NULL);
			if (hr == NOERROR) 
			{
				id++;
				(long)SendMessage(hList, CB_ADDSTRING, 0,(LPARAM)var.bstrVal);
				SysFreeString(var.bstrVal);
			}
			pBag->Release();
		}
		pM->Release();
    }
	return id;
}
开发者ID:hiccupzhu,项目名称:misc_starting,代码行数:41,代码来源:VMR_Capture.cpp

示例13: EnumDSF

void EnumDSF(void)
{
	ICreateDevEnum *pCreateDevEnum;
	IEnumMoniker *pEnumMoniker;
	IMoniker *pMoniker;
	ULONG nFetched;
	char buf[256];

	CoCreateInstance(CLSID_SystemDeviceEnum, NULL, CLSCTX_INPROC_SERVER, IID_ICreateDevEnum, (PVOID *)&pCreateDevEnum);

	if (pCreateDevEnum->CreateClassEnumerator(CLSID_VideoCompressorCategory, &pEnumMoniker, 0) != S_OK)
	{
		pCreateDevEnum->Release();
		return;
	}

	pEnumMoniker->Reset();

	while (pEnumMoniker->Next(1, &pMoniker, &nFetched) == S_OK)
	{
		IPropertyBag *pPropertyBag;
		VARIANT varFriendlyName;
		WCHAR *pwszDisplayName;

		pMoniker->GetDisplayName(NULL, NULL, &pwszDisplayName);
		varFriendlyName.vt = VT_BSTR;
		pMoniker->BindToStorage(0, 0, IID_IPropertyBag, (void **)&pPropertyBag);
		pPropertyBag->Read(L"FriendlyName", &varFriendlyName, 0);
		wsprintf(buf, "DSF\t1\t%S\t%S\n", varFriendlyName.bstrVal, pwszDisplayName);
		printf("%s", buf);
		VariantClear(&varFriendlyName);
		CoTaskMemFree(pwszDisplayName);
		pPropertyBag->Release();
		pMoniker->Release();
	}

	pEnumMoniker->Release();
	pCreateDevEnum->Release();
}
开发者ID:umezawatakeshi,项目名称:vclist,代码行数:39,代码来源:vclist-enum.cpp

示例14: Enumerar

int  Captura::Enumerar(HWND hList)
{
	if (!hList)
		return  -1;

	
	int id = 0;

	//CComPtr<ICreateDevEnum> pCreateDevEnum;
    ICreateDevEnum * pCreateDevEnum;
    HRESULT hr = CoCreateInstance(CLSID_SystemDeviceEnum, NULL, CLSCTX_INPROC_SERVER,
			  IID_ICreateDevEnum, (void**)&pCreateDevEnum);
    if (hr != NOERROR)
	{

		return -1;
	}



//    CComPtr<IEnumMoniker> pEm;
    IEnumMoniker *pEm;
    hr = pCreateDevEnum->CreateClassEnumerator(CLSID_VideoInputDeviceCategory,
								&pEm, 0);
    if (hr != NOERROR) 
	{

		return -1 ;
    }

    pEm->Reset();
    ULONG cFetched;
    IMoniker *pM;
    while(hr = pEm->Next(1, &pM, &cFetched), hr==S_OK)
    {
		IPropertyBag *pBag;
		hr = pM->BindToStorage(0, 0, IID_IPropertyBag, (void **)&pBag);
		if(SUCCEEDED(hr)) 
		{
			VARIANT var;
			var.vt = VT_BSTR;
			hr = pBag->Read(L"FriendlyName", &var, NULL);
			if (hr == NOERROR) 
			{
				TCHAR str[2048];		


				id++;
				WideCharToMultiByte(CP_ACP,0,var.bstrVal, -1, str, 2048, NULL, NULL);


				(long)SendMessage(hList, CB_ADDSTRING, 0,(LPARAM)str);

				SysFreeString(var.bstrVal);
			}
			pBag->Release();
		}
		pM->Release();
    }
	return id;
}
开发者ID:BackupTheBerlios,项目名称:visionrobot,代码行数:61,代码来源:Captura.cpp

示例15: CDXFilter


//.........这里部分代码省略.........
	 (LPVOID *)&s->m_pIDXFilter);
	if(FAILED(hr))
	{
		return -7;
	}

	hr = s->m_pGraph->AddFilter(s->m_pIDXFilter, L"DXFilter Filter");
	if(FAILED(hr))
	{
		return -8;
	}

#ifdef WM6
	ICreateDevEnum *pCreateDevEnum = NULL;
	IEnumMoniker *pEnumMoniker = NULL;
	IMoniker *pMoniker = NULL;

	ULONG nFetched = 0;

	hr = CoCreateInstance(CLSID_SystemDeviceEnum, NULL, CLSCTX_INPROC_SERVER, 
		IID_ICreateDevEnum, (PVOID *)&pCreateDevEnum);
	if(FAILED(hr))
	{
		return -9;
	}

	hr = pCreateDevEnum->CreateClassEnumerator(CLSID_VideoInputDeviceCategory,
		&pEnumMoniker, 0);
	if (FAILED(hr) || pEnumMoniker == NULL) {
		//printf("no device\n");
		return -10;
	}

	pEnumMoniker->Reset();

	hr = pEnumMoniker->Next(1, &pMoniker, &nFetched);
	if(FAILED(hr) || pMoniker==NULL)
	{
		return -11;
	}

	hr = pMoniker->BindToObject(0, 0, IID_IBaseFilter, (void**)&s->m_pDeviceFilter );
	if(FAILED(hr))
	{
		return -12;
	}

	s->m_pGraph->AddFilter(s->m_pDeviceFilter, L"Device Filter");

	pMoniker->Release();
	pEnumMoniker->Release();
	pCreateDevEnum->Release();
#else
	WCHAR wzDeviceName[ MAX_PATH + 1 ];
	CComVariant   varCamName;
	CPropertyBag PropBag;
    CComPtr<IPersistPropertyBag>    pPropertyBag;
	GetFirstCameraDriver(wzDeviceName);

	hr = s->m_pDeviceFilter.CoCreateInstance( CLSID_VideoCapture ); 
	if (FAILED(hr))
	{
		return -8;
	}

	s->m_pDeviceFilter.QueryInterface( &pPropertyBag );
开发者ID:hunghtbk,项目名称:LinphoneV1,代码行数:67,代码来源:wincevideods.c


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