![]() ![]() The GetIids method is used for runtime reflection. I guess you could do that, but it wouldn’t help much. Shouldn’t we also remove IStringable from that list? Now, there is also a method on IInspectable called GetIids which returns a list of the Windows Runtime interfaces implemented by an object. The imaginary is_ stringable_ enabled() function should be based on some immutable state, or at least state which becomes immutable once the is_ stringable_ enabled() function is called. ![]() Otherwise, we forward the call to the base class to continue normally.Īs I noted before, according to COM rules, once you decide whether or not IStringable is supported, you have to stick with that decision for the lifetime of the object. If not, then we return nullptr immediately, which causes the QueryInterface to fail with E_ NOINTERFACE. When a query comes in for IStringable, we check whether IStringable support is enabled. Void* find_interface(winrt::guid const& id) const noexcept override The extension point for removing an interface in C++/WinRT is the find_interface virtual method: We can override it to filter out interfaces we don’t like. Just be careful to follow the rules: Every attempt to query for a specific interface from an object must return a consistent result (either always succeed for that interface or always fail for that interface). You might want to do this if you want to support an interface only conditionally. But what about the reverse case? What if you want to remove an interface that was listed in your implements template? We saw some time ago that the C++/WinRT library provides an extension point for adding additional interfaces that aren’t declared in your implements template. ![]()
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |