Hey,
So this should be easy, but for some reason I can't get it working. I have a pointer to an IHTMLElement which is an anchor.
I want to get out the href and if theres an img in there, the src of the image and its rect on the screen (x,y, length, width).
eg, if the html is <a href="blah"><img src="haha"></a>, i want "blah" and "haha"
I got the href by calling getAttribute, which was easy enough. I can't figure out how to get the src of an img if its there. Heres what I've tried so far:
1) innerHTML and innerText - there methods give me a BSTR null, even when there is an img tag between the <a> and </a>.
2) get_children() - I called get_children, then called IHTMLElementCollection::tags on the collection I got, extracted the collection of images, and then tried calling ->item on that collection giving it 0 as an index (there should be only one img). This fails on the pImage->item(zero,zero,&img); call.
3) toString() - this gives me a string "[object]", which doesn't help me much.
I've hit a wall. Does anyone know how to get this done I considered getting all the html of the whole document and parsing it, but I want to get this out given the anchor object. I still haven't attempted the screenX and screenY for the img. I figure it will be easier once I have access to the img object.
Thanks for any help.
-K

Getting information about an IHTMLElement
Aarkay
Nevermind, I got it. I'm an idiot.
I could just call getAttribute with "src". who'd have thought.