Also, assuming you have ActivePerl installed, you can get the
methods/properties/events directly from the OLE browser by going to the
documentation, and scrolling down to Win32::OLE::Browser. This is an object
browser which shows whatever is in the type library for the object. Microsoft
Internet Controls is where the object represented by
"InternetExplorer.Application" is under, while Microsoft Shell Controls And
Automation is where "Shell.Application" can be found.
I would personally use the "InternetExplorer.Application" for your purpose. It
seems that either one is a base class for the other, or they both inherit from
the same base class. However, I would prefer to know for sure all the methods
available rather than just expecting since I personally do not know which of
the two above is the case...
Larent, thanks for that great example! Note that I moved the lines:
my $Length = $OLEControl->{Document}->{frames}->length;
print "This document have $Length Frame or iFrame\n";
Into a sub and called it at the very end of the DocumentComplete_Event,
otherwise, it crashes with a GPF on my machine...
Joe
> -Original Message-
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On
> Behalf Of Laurent ROCHER
> Sent: Tuesday, March 30, 2004 1:30 PM
> To: [EMAIL PROTECTED]; perl-win32-gui-users@lists.sourceforge.net
> Subject: Re: [perl-win32-gui-users] Internet explorer,
> AxWindow, WIN32::OLE
>
> 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 ++;
}
}
}
---
This SF.Net email is sponsored by: IBM Linux Tutorials Free Linux tutorial
presented by Daniel Robbins, President and CEO of GenToo technologies. Learn
everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
___
Perl-Wi