Cheyne
2006-02-01 22:25:21 UTC
I have an embedded filter that I can access directly.
Is it possible to create an instance of it without having to use the registry?
Currently I register it and create it using CoCreateInstance.
How can I create it internally?
What steps do I need to take to create it and assign it an interface to
access it by?
I have tried the following but it quits during the QueryInterface call
IBaseFilter *pSourceBase;
IUnknown *pSourceUnknown;
HRESULT hr = E_ABORT;
CUnknown *foo = CAsyncFilter::CreateInstance(pSourceUnknown, &hr);
if (hr != S_OK){
fprintf(log,"CreateInstance failed: HRESULT is %ld\n", hr);
fflush(log);
return hr;
}
//Query additional intefaces
// this does not work - it did work when I used CoCreateInstance
// the program exits here during the QueryInterface call
hr = pSourceUnknown->QueryInterface(IID_IBaseFilter, (void **)&pSourceBase);
if (hr != S_OK){
fprintf(log,"IID_IBaseFilter HRESULTS is %ld\n", hr);
fflush(log);
return hr;
}
// filter code snippit
CUnknown* CAsyncFilter::CreateInstance(LPUNKNOWN pUnk, HRESULT *phr)
{
return new CAsyncFilter(pUnk, phr);
}
//constructor
CAsyncFilter::CAsyncFilter(LPUNKNOWN pUnk, HRESULT *phr) :
CAsyncReader(NAME("Mem Reader"), pUnk, &m_Stream, phr)
{
}
Is it possible to create an instance of it without having to use the registry?
Currently I register it and create it using CoCreateInstance.
How can I create it internally?
What steps do I need to take to create it and assign it an interface to
access it by?
I have tried the following but it quits during the QueryInterface call
IBaseFilter *pSourceBase;
IUnknown *pSourceUnknown;
HRESULT hr = E_ABORT;
CUnknown *foo = CAsyncFilter::CreateInstance(pSourceUnknown, &hr);
if (hr != S_OK){
fprintf(log,"CreateInstance failed: HRESULT is %ld\n", hr);
fflush(log);
return hr;
}
//Query additional intefaces
// this does not work - it did work when I used CoCreateInstance
// the program exits here during the QueryInterface call
hr = pSourceUnknown->QueryInterface(IID_IBaseFilter, (void **)&pSourceBase);
if (hr != S_OK){
fprintf(log,"IID_IBaseFilter HRESULTS is %ld\n", hr);
fflush(log);
return hr;
}
// filter code snippit
CUnknown* CAsyncFilter::CreateInstance(LPUNKNOWN pUnk, HRESULT *phr)
{
return new CAsyncFilter(pUnk, phr);
}
//constructor
CAsyncFilter::CAsyncFilter(LPUNKNOWN pUnk, HRESULT *phr) :
CAsyncReader(NAME("Mem Reader"), pUnk, &m_Stream, phr)
{
}