use strict; use Win32::OLE qw(EVENTS); use Win32::OLE::Variant; $|=1; my $ie = Win32::OLE->new('InternetExplorer.Application'); $ie->{Visible} = 1; Win32::OLE->WithEvents($ie, \&Event, 'DWebBrowserEvents2'); while (1) { Win32::OLE->SpinMessageLoop; Win32::Sleep(100); } sub Event { my ($obj,$event,@args) = @_; print "\nEvent: $event\n"; for my $arg (@args) { my $value = $arg; $value = sprintf "[%s %s]", Win32::OLE->QueryObjectType($value) if UNIVERSAL::isa($value, 'Win32::OLE'); print " arg: $value\n"; } }