本机C++传递 IIterable 到 WinRT

Native C++ passing IIterable to WinRT

本文关键字:WinRT IIterable 传递 C++ 本机      更新时间:2023-10-16

我有一个使用WRL(Windows运行时模板库)访问WinRT API的Win32应用程序。

如何调用从本机C++获取IIterable的函数?我的问题是获得实现IIterableIVector的东西。

举个具体的例子,假设我想在 Include\10.0.14393.0\winrt\windows.ui.input.h 中调用SetDefaultMenuItems

namespace ABI {
namespace Windows {
namespace UI {
namespace Input {
MIDL_INTERFACE("A6B79ECB-6A52-4430-910C-56370A9D6B42")
IRadialControllerConfiguration : public IInspectable
{
public:
virtual HRESULT STDMETHODCALLTYPE SetDefaultMenuItems( 
/* [in] */ __RPC__in_opt __FIIterable_1_Windows__CUI__CInput__CRadialControllerSystemMenuItemKind *buttons) = 0;
// ...
};
}
}
}
}

对于本机C++,似乎没有IIterableIVector的库存实现。

我最终使用cppwinrt来做我想做的事情。有了这个,我能够将香草标准容器等传递给 WinRT。