Monday, March 12, 2012

webBrowser Control IHTMLFramesCollection2 problem

Hi all,

I am new to webBrowser Control. Currently, I am try to get the frame elements(iframe, frame) and display their names.

What I did

1. Stores all frames in framecollection(IHTMLFramesCollection2,am i right?)

2. Try to get one frame and use loop to get the values I want.

The difficult thing is I cannot get a frame from framecollection, and did not find the answer over the google.

The code is below

IHTMLDocument2 HTMLDocument =

wbMain.Document.DomDocumentasIHTMLDocument2;

IHTMLFramesCollection2 frameCollection = (IHTMLFramesCollection2)HTMLDocument.frames;string strResult="";

;

for (int iIndex = 0; iIndex < frameCollection.length; iIndex++)

{

//Object objIndex = (Object)iIndex;--wrong

//IHTMLFrameBase frmBase= (IHTMLFrameBase)frameCollection.item(ref objIndex);--wrong

strResult = strResult + frmBase.name;

}

Thnx in advance

I got it working...

I usedIHTMLWindow2. Then solved the problems

0 comments:

Post a Comment