From: Frazier, J. J. <Joe...@Pe...> - 2001-06-01 15:44:32
|
> -----Original Message----- > From: Frazier, Joe Jr=20 > Sent: Friday, June 01, 2001 11:35 > To: 'per...@li...' > Subject: RE: [perl-win32-gui-users] Opening a *New* Browser Window? >=20 >=20 >=20 >=20 > > -----Original Message----- > > From: Morbus Iff [mailto:mo...@di...] > > Sent: Friday, June 01, 2001 10:50 > > To: per...@li... > > Subject: Re: [perl-win32-gui-users] Opening a *New* Browser Window? > >=20 > >=20 > > >>| Well, then you just take the best of both ... first, you=20 > > open a new > > >>| window and then you do what you did before. I pretty=20 > > sure that the > > >>| ShellExecute will target this new browser. At least,=20 > > when I click a link > > > > > >That was so blatantly obvious that I'm hiding in a corner=20 > > for not seeing it > > >myself. I tried it this morning using the following code: > > > > Check your logic.... >=20 > > > use Win32::TieRegistry; > > > my $http =3D=20 > $Registry->{"Classes\\http\\shell\\open\\command"}->{'\\'}; > > > unless ( fork ) { system("$http"); } > You call system here..... and then... > > > use Win32::API; > > > my $ShellExecute =3D new Win32::API("shell32",=20 > "ShellExecuteA", > > > ['N','P', 'P', 'P', 'P', 'I'], 'N'); > > > $ShellExecute->Call(0, "open", $url, 0, 0, 1); >=20 > You call the ShellExecuteA. This results in two windows. =20 > Now... I have never used fork, so i dont know the exact=20 > syntax, but somthing like this.... >=20 >=20 > use Win32::TieRegistry; > use Win32::API; > my $http =3D = $Registry->{"Classes\\http\\shell\\open\\command"}->{'\\'}; >=20 > unless (`start $http $url`){ # if this call fails,=20 > do this..... >=20 > my $ShellExecute =3D new Win32::API("shell32",=20 > "ShellExecuteA",['N','P', 'P', 'P', 'P', 'I'], 'N'); > $ShellExecute->Call(0, "open", $url, 0, 0, 1); > } >=20 or..... (doh!)=20 use Win32::TieRegistry; use Win32::API; $url =3D "http://www.activestate.com"; my $http =3D $Registry->{"Classes\\http\\shell\\open\\command"}->{'\\'}; unless ( $pid =3D fork ) { system("$http $url"); } # note the adding of $pid =3D =09 # and the adding of the $url if($pid){ # note to check if the other thing returned good pid... my $ShellExecute =3D new Win32::API("shell32", "ShellExecuteA",['N','P', 'P', 'P', 'P', 'I'], 'N'); print $ShellExecute,"\n"; $ShellExecute->Call(0, "open", $url, 0, 0, 1); } print $pid, "\n"; undef $ShellExecute; > > >This works fine in IE6b. I'll assume it works fine=20 > > elsewhere. It does very > > >weird things on Mozilla though. Can anyone try this on=20 > > Netscape to see if > > >it's similar (I don't have NS on this machine, only Moz). > >=20 > > Correction. This does not work on IE6. Opens two windows. > >=20 > >=20 > > Morbus Iff > > .sig on other machine. > > http://www.disobey.com/ > > http://www.gamegrene.com/ > >=20 > >=20 > > _______________________________________________ > > Perl-Win32-GUI-Users mailing list > > Per...@li... > > http://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users > >=20 >=20 |