sorry, I realised there wwas lots of mistakes in my
code
I just c/p it from one of my code, modifing it on
the fly...
use Win32::OLE qw(EVENTS);
# don't forget the qw(EVENTS) !
my $url= ""
href="">http://www.perl.com/;
my $IE =
&OpenBrowser($url);
for (;;) {
$url= "" #
update current url
# Do what you want (you would
better add a pause like select(undef,undef,undef,0.001) to prevent any CPU
overload)
Win32::OLE->SpinMessageLoop; }
sub Event { my (
$Obj,$Event,@Args ) = @_; #print "Event triggered:
'$Event'\n"; if ($Event eq
"Quit") {
$IE =
&OpenBrowser($url);
} }
sub OpenBrowser {
my $url = "">
my $IE =
Win32::OLE->new("InternetExplorer.Application.1") or die "Error:
$!"; $IE->Navigate($url);
$IE->{'Visible'} = 1;
Win32::OLE->WithEvents( $IE,
\&Event, 'DWebBrowserEvents' );
# I use the 'DWebBrowserEvents'
interface but I think other interface may be used, with the OnQuit event instead
of Quit...
return $IE;
}
----- Original Message -----
Sent: Thursday, November 28, 2002 9:19
AM
Subject: Re: Preventing IE close
You can catch the "close" event, and then reopen
IE:
Try something like this (you can also use the
EventLoop but I didn't managed to make it work) :
my $Quit = 0;
use Win32::OLE qw(EVENTS);
$IE =
Win32::OLE->new("InternetExplorer.Application.1") or die "Impossible de
creer l'OLE InternetExplorer"; $IE->Navigate("http://".$adresse); $IE->{'Visible'} =
1; Win32::OLE->WithEvents( $IE, \&Event,
'DWebBrowserEvents' ); $Quit =
0;
for (;;) {
$adresse =
$IE->{LocationURL};
# Do what you want (you would
better add a pause like select(undef,undef,undef,0.001) to prevent any CPU
overload)
Win32::OLE->SpinMessageLoop; }
sub Event { my (
$Obj,$Event,@Args ) = @_; #print "Event triggered:
'$Event'\n"; if ($Event eq
"Quit") {
$IE =
Win32::OLE->new("InternetExplorer.Application.1") or die "Impossible de
creer l'OLE InternetExplorer";
$IE->Navigate("http://".$adresse);
$IE->{'Visible'} = 1;
} }
----- Original Message -----
Sent: Wednesday, November 27, 2002 8:18
PM
Subject: Preventing IE close
I am using Win32::OLE to display some analysis
results in an Internet Explorer window. I want to have the same window
available for display of different results, so I want the user to be able to
minimize it but not close the window. Is there a way I can eliminate
the close button, or maybe trap the event it generates and make that event
minimize the window instead?
Steve
|