dattebayo
dattebayo

Reputation: 2072

How to get the screen coordinate of web-page elements in BHO

I am writing a BHO object for IE.

I want the screen position of the top-left of the web-page. How can i get this position? The topleft of the first element in DOM returns (0,0). The webBrowser.Left or Top returns the position of the browser but not the top-left of the page. I am using IWebBrowser2.

Thanks a million,

-anony.

Upvotes: 0

Views: 985

Answers (2)

dattebayo
dattebayo

Reputation: 2072

I solved the problem myself.

The IHTMLElement2.getBoundingClientRect() and IHTMLElement2.getClientRects() solved the problem.

-Datte

Upvotes: 0

GotAmye
GotAmye

Reputation: 369

You may have already figured this out, but using ClientToScreen function might help you.

Upvotes: 1

Related Questions