Asked By Tomy
10-Apr-07 08:14 AM

Hi
I`ve qestion about implement custom interface in source filter
class myclass : public CSource
{
.
.
STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void ** ppv);
.
.
};
class CVCamStream :public custom_class, public CSourceStream, public
IAMStreamConfig, public IKsPropertySet
{
public:
.
.
STDMETHODIMP my_custom_function(void)
{
return NOERROR;
}
.
.
};
compilation OK
I tried to implement STDMETHODIMP my_custom_function(void) in myclass
class myclass :public custom_class, public CSource
{
.
.
STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void ** ppv);
STDMETHODIMP my_custom_function(void)
{
return NOERROR;
}
.
.
};
but It can`t compile properly:
error C2259: 'myclass' : cannot instantiate abstract class
due to following members:
'ULONG IUnknown::AddRef(void)' : is abstract
c:\Program Files\Microsoft Platform SDK for Windows Server 2003
R2\include\unknwn.h(117) : see declaration of 'IUnknown::AddRef'
'ULONG IUnknown::Release(void)' : is abstract
c:\Program Files\Microsoft Platform SDK for Windows Server 2003
R2\include\unknwn.h(119) : see declaration of 'IUnknown::Release'
I've qestion about location of my_custom_function(void);. Is it correct
implementation in CVCamStream ?
my custom_interface implementation is in my_custom.h flie
my_custom.h
extern "C" {
DEFINE_GUID(IID_custom_class)
0x5022190a, 0x65d9, 0x4a06, 0xb8, 0x0a, 0x28, 0xb4, 0xe7, 0x8f, 0x44,
0xa6);
DECLARE_INTERFACE_(custom_class, IUnknown)
{
STDMETHOD(my_custom_function) (THIS_
void)PURE;
};
}
I`ve problem with call to this function "my_custom_function()" from windows
application (C++ visual studio 2005 .net)
include "my_custom.h"
IBaseFilter *pVideoInputFilter;
CComQIPtr<custom_class> my_pointer(pVideoInputFilter);// pVideoInputFilter
that has already been created with CoCreateInstance
if (!my_pointer)
{
return hr;
}
my_pointer->my_custom_function();
I can`t compile my windows application. I have compiler error :
P1.cpp
C:\Program Files\Microsoft Visual Studio
8\VC\atlmfc\include\atlcomcli.h(474) : error C2787: 'custom_class' : no GUID
has been associated with this object
AssemblyInfo.cpp
Generating Code...
Build log was saved at "file://d:\filters\new1\P1\P1\Debug\BuildLog.htm"
P1 - 1 error(s), 0 warning(s)
========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========
Please clue me something !