Sign in to follow this  
ArchG

[.net] c# problems with mshtml.IHTMLElement

Recommended Posts

hi, i've got a custom WebBrowser control, and I need to do some work with the dom. I need access to the children of an element, but I don't really know what type they are or how to get access to them..the intellisense only tells me they are objects

mshtml.IHTMLElement element = dom.getElementById("rootElement");

foreach (mshtml.IHTMLElement child in element.children)
{
//do my stuff
}

^^that doesn't work, as there is no getenumerator, I can't cast it into an array of mshtml.IHTMLElement[]...I'm unsure of what to do with this. Any help?

Share this post


Link to post
Share on other sites
What is the runtime type when you set a breakpoint and examine the element.children property at runtime?

Share this post


Link to post
Share on other sites
children = {System.__ComObject}

maybe this is simple, but this com marshalling stuff is a little over my head...or i'm missing something pretty key to grasp it.

Share this post


Link to post
Share on other sites
Where did you get the custom webbrowser control?
Obviously it is using some COM component. When you know what component that is (probably IE) you should be able to look up its SDK/help.

EDIT:
IHTMLElement is an interface of IE (see this)

By googling I found this it might help you to understand the API

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this