THIS IS NOT A HTML / JAVASCRIPT / CSS question!

Check out these images: X offset negligible; Y offset relevant

enter image description here

I need to get the HTML display area (aka viewport) offset to the 0/0 of the IE window.

  • I am targeting Microsoft Internet Explorer 11.
  • I am using C# with SHDocVw.InternetExplorer library to access/control the IE.

What I actually want to do is to trigger double-click events

  • similar to IHTMLElement.click(), just a doubleClick()
  • calling IHTMLElement.click() multiple times does not work

I tried to solve it WITHOUT actually clicking:

So right now I'm controlling the mouse to trigger certain events, calling [DllImport("user32.dll")] public static extern bool GetCursorPos(out PointInter lpPoint); and the like to get and set the mouse cursor and to simulate double-clicks on certain elements.

For the mouse navigation I already take into consideration

  • the OS's desktop zoom/scale setting
  • the IE window Left and Top properties
  • the location of the IHTMLElement(3).getClientBoundingRect, i.e. the position of the element I wanna trigger

This all works perfectly fine when the IE configuration is the same. My assumptions:

  • same HTML viewport offset (same toolbars, menus etc)
  • HTML viewport scaling 100% (no page zooming)

But those two factors are dynamic, so I have to account for them in some way.

So what I need is:

  • The HTML viewport's vertical offset (in both screenshots it's 106 pixels)
  • The HTML viewport's horizontal offset (in first its 1, in second it's 291)
  • The HTML viewport's zoom factor (in both screenshots 100%)

I have tried accessing multiple elements in the ShDocVw.InternetExplorer object, but I either have the wrong interface casts or it does not expose this information willingly, because I could not find it yet.

From a delve into the google world I also came up empty, so no (obvious) answers there either.

So does any one of you know how to deal with this problem? Some obscure COM/OLE incantations and rituals that could guide the mouse cursor on its way?

EDIT:

Dirty solution: I could display some homemade HTML/JS page first, that detects my simulated mouse movement and dump that information into some (invisible) div, then read that data in C#.

Though this is a solution, it's quite ugly and not useful for taking into account layout/display changes that might occur during later runtime, if user changes zooms while the app is working.

0

There are 0 answers