Share via

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

Korade, Pallavi 1 Reputation point
2022-01-05T09:24:45.697+00:00

I am unable to retrieve pdocWdw parameter 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)
{
         pDoc = pdocWdw->Document;
} 

For Word, pDoc = pdocWdw->Document; returns the proper value, but in case of Outlook it throws an com exception(0x800a13e9) from get_Document() method.

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

Microsoft 365 and Office | Development | Other
Developer technologies | C#
Developer technologies | C#

An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.