Interop and Video For Windows

Hello,

I've written a library that uses the Video For Windows interface a long time ago. Back then, I didn't realize that interfaces were defined and that the functions were "C wrappers" so I used the C functions. I.e. I've been using AVIFileOpen instead of IAVIFile interface.

I am trying to migrate to C++/CLI now and I am having a problem. My class looks something like:

ref class MyVfw {
public: IAVIFile *iavf;
};

However, this creates the error:

error C2664: 'AVIFileOpenW' : cannot convert parameter 1 from 'cli::interior_ptr<Type>' to 'PAVIFILE *'

since the CLR wants to manage the pointer and AVIFileOpen knows nothing about that. Now, using pin_ptr<> every time I use a VFW function is really ugly in my opinion and hence was trying to use the COM interface directly.

I tried to use tlbimp with avifile32.dll but it didnt seem to like the DLL.

Is there any way I can use IAVIFile and the rest of the interfaces in .NET using a kind of COM Interop

Thanks in advance,

Georgios


Answer this question

Interop and Video For Windows