I have a custom DirectShow filter created by extending the ezrgb24 filter from the DirectShow sample documentation.
I am using this filter (indirectly) in C# through a 3rd party multimedia SDK (LeadTools). Now I need to add a reference to the filter’s DLL to the project so that I can cast an IUnknown interface retrieved by the SDK to the filter’s own custom interface.
I have tried adding the DLL reference through add reference -> browse, and by using tlbimp directly at the commandline. Both approaches result in the error ‘C:\windows\system32\ezrgb24.dll’ is not a valid type library.
Am I missing something? The extensions I have made to the ezrgb24 example are pretty trivial structurally, essentially if anyone has the DirectShow examples they know exactly the code I am working with.
Any and all help is greatly appreciated.
Tony.
You need to write interface in C# and use ComImport attribute. For example sample filter from SDK will look
Now you can use interface definition is such way
NOTE: in interface definition there is
REFTIMEtype as parameter for length and startTime, but it is simple typedef and that’s why in our code it isdouble. For more information on converting interface definition to C# you can read marshaling article on msdn