Can I use the AccessibleObjectFromWindow() function to retrieve the address of the interface for the Outlook window object?

  add-in, c++, ms-word, outlook-addin

I am trying to resolve one bug with AccessibleObjectFromWindow().

I am unable to retrieve ppvObject for Outlook, whereas it works well for MSWord.

WindowPtr pdocWdw;
HRESULT var = AccessibleObjectFromWindow( hControlWnd, DWORD(OBJID_NATIVEOM),
        __uuidof(WindowPtr), (PVOID*)&pdocWdw );
_DocumentPtr pDoc;

if(pdocWdw != NULL)
    m_pdocWdw = pdocWdw;
    pDoc = pdocWdw->Document;

For Word, pDoc = pdocWdw->Document; returns the proper value, but in case of Outlook it throws an exception.

Can anybody please tell if I can use AccessibleObjectFromWindow() for Outlook? If not, what alternative can I use?

Source: Windows Questions C++