use strict; use threads; use threads::shared; our$oleobject; $oleobject=Win32::OLE->new("AutoItX3.Control"); my $aut =threads->new(\&check_popup,"check_popup_thread"); $aut->detach(); MYFunction(); exit(0); sub check_popup { require Win32::OLE; my $name =@_; print $name; while(1) { if($oleobject->WinWait('POPUP','',1); { $oleobject->WinClose('POPUP'); } } }