Quantcast
Channel: Windows Desktop Development for Accessibility and Automation forum
Viewing all articles
Browse latest Browse all 585

Implementation of IRawElementProviderFragmentRoot

$
0
0
Hello, I need your help. I am tring to use UIAutomation with my controls. So, I have:
class MenuProvider : public IRawElementProviderSimple,
                     public IRawElementProviderFragment,
                     public IRawElementProviderFragmentRoot 
And
class MenuProviderItem : public IRawElementProviderSimple,
                         public IRawElementProviderFragment
MenuProvider::QueryInterface looks like this:
IFACEMETHODIMP MenuProvider::QueryInterface(REFIID riid, void** ppInterface)
{
    if (riid == IID_IUnknown)                              *ppInterface =static_cast<IRawElementProviderSimple*>(this);
    else if (riid == IID_IRawElementProviderSimple)        *ppInterface =static_cast<IRawElementProviderSimple*>(this);
    else if (riid == IID_IRawElementProviderFragment)      *ppInterface =static_cast<IRawElementProviderFragment*>(this);
    else if (riid == IID_IRawElementProviderFragmentRoot)  *ppInterface =static_cast<IRawElementProviderFragmentRoot*>(this);
    else
    {
        *ppInterface = NULL;
        return E_NOINTERFACE;
    }
    (static_cast<IUnknown*>(*ppInterface))->AddRef();
    return S_OK;
}
And in my control class I do this thing:
BEGIN_MSG_MAP(...)
    ...
    UIAUTOMATION_MESSAGE_HANDLE_WMGETOBJECT_DEFAULT
    CHAIN_MSG_MAP(...)
END_MSG_MAP()
Where:
#define UIAUTOMATION_MESSAGE_HANDLE_WMGETOBJECT(providerGetter) \
        if (uMsg == WM_GETOBJECT) \
        { \
            bHandled = TRUE;\
            if (static_cast<long>(lParam) == static_cast<long>(UiaRootObjectId)) \
            { \
                lResult = UiaReturnRawElementProvider(hWnd, wParam, lParam, providerGetter(hWnd)); \
            } \
            else \
            { \
                lResult = 0; \
            } \
            if (bHandled) \
                return TRUE; \
        } 
The problem is: MenuProvider::QueryInterface is never asked to give IRawElementProviderFragmentRoot interface (all other are asked), so Inspect Objects see the structure of my control (it's fragments), but it does not react on mose move over control (because MenuProvider::ElementProviderFromPoint (from IRawElementProviderFragmentRoot) never runs).
So, what is wrong?


Viewing all articles
Browse latest Browse all 585

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>