Hi
Sorry for the late Post in this Thread, but i got the same problem.
I'm using VS2005 Express and the latest PSDK.
If is use the following code, the read-function doesnt succeed:
Code: Select all
if(CoCreateInstance(CLSID_FilterGraph,NULL,CLSCTX_INPROC_SERVER,IID_IFilterGraph,(void**)&myFilterGraph)!=S_OK)
{
MessageBox(g_hWnd,(LPCTSTR)L"FilterGraph konnte nicht gestartet werden",(LPCTSTR)L"Fehler",MB_OK);
myFilterGraph=NULL;
}
if(CoCreateInstance(CLSID_SystemDeviceEnum,NULL,CLSCTX_INPROC,IID_ICreateDevEnum,(void**)&myDeviceEnumerator)!=S_OK)
{
MessageBox(g_hWnd,(LPCTSTR)L"SystemDeviceEnumerator konnte nicht gestartet werden.",(LPCTSTR)L"Fehler",MB_OK);
myDeviceEnumerator=NULL;
}
hr=myDeviceEnumerator->CreateClassEnumerator(CLSID_VideoInputDeviceCategory,&myEnumCategory,0);
if(hr==S_OK)
{
//erfolgreich, also alle Devices auflisten
IMoniker* myMoniker;
while(myEnumCategory->Next(1,&myMoniker,&cFetched)==S_OK)
{
//ein weiteres Device gefunden
hr=myMoniker->BindToStorage(0,0,IID_IPropertyBag,(void**)&myDeviceEigenschaften);
if(hr==S_OK)
{
VARIANT var;
VariantInit(&var);
hr=myDeviceEigenschaften->Read(L"DevicePath",&var,NULL);
if(hr==S_OK)
{
MessageBox(g_hWnd,(LPCWSTR)var.bstrVal,(LPCWSTR)L"Name",MB_OK);
}
VariantClear(&var);
myDeviceEigenschaften->Release();
}
myMoniker->Release();
}
}
else
{
MessageBox(g_hWnd,(LPCWSTR)L"CreateClassEnumerator schlug fehl",(LPCWSTR)L"Fehler",MB_OK);
myEnumCategory=NULL;
}
Does anyone know every Name of Property to use with the Read Function?
Or depends the available Propertys of the device?
Sorry for the bad English.
Reinhold Fischer