0
  1. Acquiring the IAccessible pointer to an element within the page or the accessible window of the document for Window class Internet Explorer_Server is successfully using the code (where hwnd is the handle of Internet_Explorer_server) AccessibleObjectFromWindow(hwnd, OBJID_WINDOW, IID_IAccessible, (void**)&pAcc)
  2. Getting an IServiceProvider interface pointer for the accessible object obtained from Step 1 is also successfully using the code HRESULT hr; hr = pAcc->QueryInterface(IID_IServiceProvider, (void **)&pSP).

However when tried to use the QueryService call on the obtained IServiceProvider using the code HRESULT hr = pServiceProvider->QueryService(IID_IHTMLWindow2, IID_IHTMLWindow2, (void**)&pWindow)it fails with a return -2147024809, which is 0x80070057. Not sure as to why this is happening, just wondering if there are any specific setting on the server machine (Windows Server 2008 R2) which is preventing this call from being successfully.

Also, the above step which I have described is successfully in Windows 7 environment.
To Note : Version of Internet Explorer installed is 10

  • The error code 0x80070057 denotes `E_INVALIDARG`, so I'd suspect you passed some invalid argument to `QueryService()`. – πάντα ῥεῖ May 26 '16 at 09:39
  • if it was an E_INVALIDARG to QueryService() then why does it pass on windows 7 environment ? – Arun Kumar M May 26 '16 at 09:43
  • QS IID_IHTMLWindow2 sometimes fail. when this happens QS IID_IHTMLElement instead. this is right in Microsoft's sample code at https://msdn.microsoft.com/en-us/library/gg701963(v=vs.85).aspx – Sheng Jiang 蒋晟 Jun 05 '16 at 03:08

0 Answers0