c++windowsmidlwrl

Use Windows::Foundation namespace interfaces in midl


I want to use interfaces defined in Windows::Foundation in my midl file. For that I wrote following sample code, but it gives compile error: Error MIDL2011 unresolved type declaration : IStringable [ Parameter 'param2' of Procedure 'MyCustomMethod2' ( Interface 'mytestmidl.MyTestInterface' ) ] mytestmidl.idl 12

How can I refer to IStringable or other interfaces from my midl file?

#include <sdkddkver.h>
import "Windows.Foundation.idl";
//using namespace Windows::Foundation;

namespace mytestmidl
{ 
   [version(1.0), uuid(332FD2F1-1C69-4C91-949E-4BB67A85BE00)] 
   interface MyTestInterface : IInspectable
   {
       HRESULT MyCustomMethod1([in] HSTRING param1);
       HRESULT MyCustomMethod2([in] IStringable *param2);
   }
}

Solution

  • I think you should prepend it with a namespace name like this:

    HRESULT MyCustomMethod2([in] Windows.Foundation.IStringable *param2);