use strict; use warnings; use Win32::API; use Win32::OLE; my $autoIt = Win32::OLE->new("AutoItX3.Control"); my $app_title = "Test App"; my $win_title_match = $autoIt->Opt("WinTitleMatchMode", 1); my $hwnd = $autoIt->ControlGetHandle($app_title, "", "[CLASS:Internet Explorer_Server; INSTANCE:1]"); # At this point we should have the HWND my $co_init = new Win32::API('ole32', 'CoInitialize', 'P', 'I'); $co_init->Call(0); my $reg_window = new Win32::API('user32', 'RegisterWindowMessage', 'P', 'I'); my $html_obj = $reg_window->Call('WM_HTML_GETOBJECT'); my $SMTO_ABORTIFHUNG = 0x0002; my $lresult = " " x 80; my $send_msg = new Win32::API('user32', 'SendMessageTimeout', 'NIIIIIP', 'N'); $send_msg->Call(hex($hwnd), $html_obj, 0, 0, $SMTO_ABORTIFHUNG, 1000, $lresult); $lresult = unpack('L', $lresult); my $aInt = pack('LSSC8',0x626FC520,0xA41E,0x11CF,0xA7,0x31,0x00,0xA0,0xC9,0x08,0x26,0x37); my $obj = new Win32::API('oleacc', 'ObjectFromLresult', 'PPIP' , 'N'); my $idisp = " " x 80; my $obj = new Win32::API('oleacc', 'ObjectFromLresult', 'NPIP' , 'N'); my $ret = $obj->Call($lresult, $aInt, 0, $idisp); print "Error: ", $autoIt->error(), "\n"; print "ret: ", $ret, "\n", "ie: ", $idisp, "\n", "idisp: ", unpack('L', $idisp), "\n";