In an application that automates IE I'm trying to get an HTML nodes screen
coordinates so I can 'flash' the node.  Thanks to this list, I'm able to
flash.  I can also get the offsets for the node within the 'BODY' tag.

Now all I need is the HWND or screen coordinates of the window holding the
BODY tag.

Each tag has a parentDocument property that returns a DispHTMLDocument
object.

The DispHTMLDocument object has a parentWindow property that returns a
IHTMLWindow2 object.

Unfortunately, the IHTMLWindow2 object does not offer a HWND or a screen
coordinates.  However the IHTMLWindow3 class DOES offer what appears to be
screen coordinates, screenLeft(Retrieves the x-coordinate of the upper
left-hand corner of the browser's client area, relative to the upper
left-hand corner of the screen.) and screenRight.

Question: How do I get from a IHTMLWindow2 to a IHTMLWindow3.

A bit of looking at the interface code in
3050F1C5-98B5-11CF-BB82-00AA00BDCE0Bx0x4x0.py reveals this snip:

class HTMLWindow2(CoClassBaseClass): # A CoClass
        CLSID = IID('{D48A6EC6-6A4A-11CF-94A7-444553540000}')
        coclass_sources = [
                HTMLWindowEvents2,
                HTMLWindowEvents,
        ]
        default_source = HTMLWindowEvents
        coclass_interfaces = [
                IHTMLWindow5,
                IHTMLWindow4,
                DispHTMLWindow2,
                IHTMLWindow3,
                IHTMLWindow2,
        ]
        default_interface = DispHTMLWindow2

This suggests that there may be a way to get from one class to the other.

Question: But how?


_______________________________________________
Python-win32 mailing list
Python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32

Reply via email to