I have the following interface from "strmif.h" (DirectShow stuff):
MIDL_INTERFACE("29840822-5B84-11D0-BD3B-00A0C911CE86")
ICreateDevEnum : public IUnknown
{
public:
virtual HRESULT STDMETHODCALLTYPE CreateClassEnumerator(
/* [in] */ REFCLSID clsidDeviceClass,
/* [out] */ IEnumMoniker **ppEnumMoniker,
/* [in] */ DWORD dwFlags) = 0;
};
I have found it described in C# like this (in a project called DShow.NET):
[ComVisible(true), ComImport,
Guid("29840822-5B84-11D0-BD3B-00A0C911CE86"),
InterfaceType( ComInterfaceType.InterfaceIsIUnknown )]
public interface ICreateDevEnum
{
[PreserveSig]
int CreateClassEnumerator(
[In] ref Guid pType,
[Out] out UCOMIEnumMoniker ppEnumMoniker,
[In] int dwFlags );
}
The generated MSIL for the function is:
.method public hidebysig newslot abstract virtual
instance int32 CreateClassEnumerator([in] valuetype [mscorlib]System.Guid& pType,
[out] class [mscorlib]System.Runtime.InteropServices.UCOMIEnumMoniker& ppEnumMoniker,
[in] int32 dwFlags) cil managed preservesig
{
} // end of method ICreateDevEnum::CreateClassEnumerator
And now my question is: How to represent this interface in C++/CLI? I use VS2005, and tried several times, but it doesn't compile. I am stuck on the IEnumMoniker parameter, don't know how to declare it.
Does anyone have an idea on how to write this interface in C++/CLI, so that I am able to cast the COM server 'SystemDeviceEnum' to the interface 'ICreateDevEnum'?
Thanks,
Cosmin