Hi >I am playing win Internet explorer in the Win32::HUI::AxWindow and OLE. >Downloading and displaying pages looks good and easy, howevere I can not figure out >if the page has frames how do I treat these frames, means, first , how do >I know if the page has frames or not, and if it has frames, how do I get >the html code, the page source of each frame and how do I know when all >frames are fully loaded.
For know your page have frame you first need to wait at least first page is load. See sample below. >Is there a docs anywhere on the properties and methods tree of the object Look in MSDN : For WebBrowser : http://msdn.microsoft.com/workshop/browser/webbrowser/browser_control_node_entry.asp Search IWebBrowser2 and DWebBrowserEvents2 COM interface reference. For MSHTML and HTMLDocument : http://msdn.microsoft.com/workshop/browser/mshtml/reference/reference.asp Search IHTMLDocument2. >Also what is the difference between, DocumentComplete and DownloadComplete events DocumentComplete is fire Fires when a document has been completely loaded and initialized. In pages with no frames, this event fires once after loading is complete. In pages where multiple frames are loaded, this event fires for each frame. DownloadComplete Fires when a downloading operation finishes. See DWebBrowserEvents2. Laurent ------------------------------------- use Win32::GUI; use Win32::OLE; use Win32::GUI::AxWindow; # main Window $Window = new Win32::GUI::Window ( -title => "Win32::GUI::AxWindow and Win32::OLE", -pos => [100, 100], -size => [600, 600], -name => "Window", ) or die "new Window"; # Create AxWindow $Control = new Win32::GUI::AxWindow ( -parent => $Window, -name => "Control", -pos => [0, 0], -size => [400, 300], -control => "Shell.Explorer", -visible => 1, ) or die "new Control"; # Get Ole object $OLEControl = $Control->GetOLE(); $Control->RegisterEvent ("DocumentComplete", "DocumentComplete_Event" ); $Window->Show(); my $MyURL = "http://wp.netscape.com/assist/net_sites/example1-F.html"; $Control->CallMethod("Navigate", $MyURL); # Wait first loading end for determinate frame number while (Win32::GUI::DoEvents() != -1 && $Control->GetProperty("Busy")) {} my $Length = $OLEControl->{Document}->{frames}->length; print "This document have $Length Frame or iFrame\n"; Win32::GUI::Dialog(); # Main window event handler sub Window_Terminate { undef $OLEControl; return -1; } sub DocumentComplete_Event { my ($Obj, $EventID, $Document, $URL) = @_; # Finish a URL (Document or a frame) print "Done URL: ", $URL, "\n"; # Finish load complete document if ($URL eq $Control->GetProperty("LocationURL")) { print "Document complete\n"; my $length = $OLEControl->{Document}->{frames}->length; my $i = 0; while ($i < $length) { print "Frame $i\n"; my $frame = $OLEControl->{Document}->{frames}->item($i); print $frame->{Document}->{body}->outerHTML, "\n"; $i ++; } } }