Our website uses cookies to enhance your browsing experience.
Accept
to the top
>
>
>
Examples of errors detected by the...

Examples of errors detected by the V1114 diagnostic

V1114. Suspicious use of type conversion operator when working with COM interfaces. Consider using the 'QueryInterface' member function.


Windows Terminal

V1114 Suspicious use of 'static_cast' when working with COM interfaces. Consider using the 'QueryInterface' member function. uiaTextRange.cpp 84


namespace Microsoft::Console::Types
{
    class ScreenInfoUiaProviderBase :
        public WRL::RuntimeClass<
            WRL::RuntimeClassFlags<WRL::ClassicCom | WRL::InhibitFtmBase>,
            IRawElementProviderSimple,
            IRawElementProviderFragment,
            ITextProvider
        >,
        public IUiaTraceable
    ....
}

namespace Microsoft::Console::Interactivity::Win32
{
    class ScreenInfoUiaProvider final :
        public Microsoft::Console::Types::ScreenInfoUiaProviderBase
    {
        ....
    }
    ....
}

HWND UiaTextRange::_getWindowHandle() const
{
    const auto provider = static_cast<ScreenInfoUiaProvider*>(_pProvider); // <=
    return provider->GetWindowHandle();
}