Interacting with Frames in WebBrowser Control of VB6 
Author Message
 Interacting with Frames in WebBrowser Control of VB6

I've been trying to develop some tools that automate web browsing activities
that I regularly do.  For example, it would be nice to have a program that
would go to a vendor's web site, navigate through to the driver section,
find the latest drivers for my video card, download them, and let me know
they're downloaded.

If I put a WebBrowser control on a form, I can access a standard HTML file
by using the Document object. For example, to find out how many HTML links
are on the page I might say:

numlinks = webbrowser1.document.links.length

Similarly, I can run though the links with a For Each loop.

But when the page in question uses frames, I'm having one heck of a time
figuring out how to do this simple task.  Imagine a page with a frameset
that includes a frame across the top with a company logo, one down the left
side with a navigation bar, and one in the lower right that is the main
content area.

What I want to do is be able to point WebBrowser to such a page, then
retrieve the links collection from the frame(s) of my choice.  Sounds simple
enough, but I've been at this off and on for about two months with no
success at all.

If I look at webbrowser1.document.links I get only the links in the document
with the highest-level "frameset" code.

If I ask VB for "webbrowser1.document.frames.length" I'll get the number of
frames on the page.

When I've tried to do anything with one of the individual "frame" objects in
the "frames" collection, I either get errors telling me the object doesn't
have that property, method, or collection... or I get "access denied"
errors. It's as though VB6 doesn't or can't go more than one frame deep into
the WebBrowser object.

Can any of you provide an example of a snippet of VB6 code which goes into
each frame of a page and gets the list of hyperlinks from that frame using
the WebBrowser control in VB6?  If not that, maybe code that would give me a
clue as to how to get through to the frames in a page.

I've bought a couple of VB6 books on web development, but they are geared to
VBScript rather that VB6. I've bought books on the DHTML and DOM, but they
drop the ball at frames, just telling you that they exist and you can work
with them.  I've dug through Microsoft's MSDN site and done Google searches
until I am blue in the face, and nothing has gotten me that list of links I
want.

Thanks, in advance, for any help you can provide.



Mon, 03 Jan 2005 23:59:22 GMT  
 Interacting with Frames in WebBrowser Control of VB6
Maybe something like WB.Scripting.Window.Frames ?

I've never tried it but you should be able to use the whole IE object model
through  WB.Scripting.

--
--

Quote:
> I've been trying to develop some tools that automate web browsing
activities
> that I regularly do.  For example, it would be nice to have a program that
> would go to a vendor's web site, navigate through to the driver section,
> find the latest drivers for my video card, download them, and let me know
> they're downloaded.

> If I put a WebBrowser control on a form, I can access a standard HTML file
> by using the Document object. For example, to find out how many HTML links
> are on the page I might say:

> numlinks = webbrowser1.document.links.length

> Similarly, I can run though the links with a For Each loop.

> But when the page in question uses frames, I'm having one heck of a time
> figuring out how to do this simple task.  Imagine a page with a frameset
> that includes a frame across the top with a company logo, one down the
left
> side with a navigation bar, and one in the lower right that is the main
> content area.

> What I want to do is be able to point WebBrowser to such a page, then
> retrieve the links collection from the frame(s) of my choice.  Sounds
simple
> enough, but I've been at this off and on for about two months with no
> success at all.

> If I look at webbrowser1.document.links I get only the links in the
document
> with the highest-level "frameset" code.

> If I ask VB for "webbrowser1.document.frames.length" I'll get the number
of
> frames on the page.

> When I've tried to do anything with one of the individual "frame" objects
in
> the "frames" collection, I either get errors telling me the object doesn't
> have that property, method, or collection... or I get "access denied"
> errors. It's as though VB6 doesn't or can't go more than one frame deep
into
> the WebBrowser object.

> Can any of you provide an example of a snippet of VB6 code which goes into
> each frame of a page and gets the list of hyperlinks from that frame using
> the WebBrowser control in VB6?  If not that, maybe code that would give me
a
> clue as to how to get through to the frames in a page.

> I've bought a couple of VB6 books on web development, but they are geared
to
> VBScript rather that VB6. I've bought books on the DHTML and DOM, but they
> drop the ball at frames, just telling you that they exist and you can work
> with them.  I've dug through Microsoft's MSDN site and done Google
searches
> until I am blue in the face, and nothing has gotten me that list of links
I
> want.

> Thanks, in advance, for any help you can provide.



Tue, 04 Jan 2005 00:17:45 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. WebBrowser control interacting with application???

2. Control scroll bars in a frame in the WebBrowser control

3. Control scroll bars in a frame in the WebBrowser control

4. Control scroll bars in a frame in the WebBrowser control

5. Control scroll bars in a frame in the WebBrowser control

6. WebBrowser without WebBrowser Control in VB6 ?

7. IE IFrame/WebBrowser control cross-frame security breech

8. Printing frames with IE 4.0 using WebBrowser Control

9. Programatically changing frames in the webbrowser control

10. HELP ! Frames and WebBrowser Control

11. Events, Frames and the WebBrowser Control

12. WebBrowser control: frames collection fails

 

 
Powered by phpBB® Forum Software