Ing. Branislav Gerzo (mail-lists) wrote:
> Hello,
> 
> I have to change IE proxy settings via perl interface. I searched the
> web for a long time, found something, coded too, but it doesn't work
> :)
> 
> ok, my goal is enable, or disable proxy in IE. Here is code:
> 
> use strict;
> use warnings;
> use Win32::TieRegistry( Delimiter=>"/", ArrayValues=>0 );
> use Win32::API;
> 
> #proxy in IE is disabled now
> my $regpath = 
> 'HKEY_CURRENT_USER/Software/Microsoft/Windows/CurrentVersion/Internet 
> Settings/';
> my $penable = $regpath . 'ProxyEnable';
> $Registry->{$penable}= '0x00000001';
> print my $pe = $Registry->{$penable}; #prints '0x00000001', so value is stored
> my $InternetSetOption = Win32::API->new("wininet", "InternetSetOption", [qw(N 
> N N N)], 'N');
> $InternetSetOption->Call(0, 39, 0, 0) || die "$!\n";
> $InternetSetOption->Call(0, 37, 0, 0) || die "$!\n";

Check out Win32::Internet instead of using the API:

use strict;
use warnings;
use Win32::Internet;
use Win32::TieRegistry (Delimiter => '/', ArrayValues => 0);

# proxy in IE is disabled now

my $regpath = 
'HKEY_CURRENT_USER/Software/Microsoft/Windows/CurrentVersion/Internet Settings';
my $penable = "$regpath/ProxyEnable";

my $pe = $Registry->{$penable};
print "pe=$pe\n";

$Registry->{$penable} = '0x00000001';

$pe = $Registry->{$penable};
print "pe=$pe\n";

# try something like this instead of API (check docs in Win32::Internet)
# you'll have to play with it to get the desired results I assume - I have
# no experience with it.

my $I = new Win32::Internet('', INTERNET_OPEN_TYPE_PROXY, '<your-proxy-host>') 
or
  die "new Win32::Internet: $! ($^E)";

__END__


-- 
  ,-/-  __      _  _         $Bill Luebkert    Mailto:[EMAIL PROTECTED]
 (_/   /  )    // //       DBE Collectibles    Mailto:[EMAIL PROTECTED]
  / ) /--<  o // //      Castle of Medieval Myth & Magic http://www.todbe.com/
-/-' /___/_<_</_</_    http://dbecoll.tripod.com/ (My Perl/Lakers stuff)
_______________________________________________
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to