在 midl 中使用 Windows::Foundation 命名空间接口



我想在我的midl文件中使用Windows::Foundation中定义的接口。为此,我编写了以下示例代码,但它给出了编译错误:错误MIDL2011未解析的类型声明:IStringable [ 过程"MyCustomMethod2"的参数"param2"(接口"mytestmidl.MyTestInterface' ) ] mytestmidl.idl 12

如何从我的 midl 文件中引用 IStringable 或其他接口?

#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);
   }
}

我认为您应该在它前面加上这样的命名空间名称:

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

最新更新