Solved

Setting internet proxy setting

Posted on 2002-03-05
2
157 Views
Last Modified: 2010-05-02
Hi,
I want to a code that will enable me to change the proxy setting of my IE from a vb code. Since I use my laptop at home and at school, I am getting tired of changing the proxy setting and releasing and renewing my IP (through winipcfg) all the time I change places
What I need is:
-A vb code that accepts a command line parameter (that is the name of the proxy server) and sets it as a proxy server (I think this can be done using wininet.dll functions)

-Release and renew the ip address (I think this can be done by using winipcfg /release_all and winipcfg /renew )

So that I can put this program (after making it an exe) as a startup program and I don't have to change anything.

I would really appreciate it if someone gives me a fully working code.(IF it is complete and I don't have to change anything,  I promise to add additional 50 points, cross my heart)


Thanks
0
Comment
Question by:oumer
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 28

Accepted Solution

by:
Ark earned 250 total points
ID: 6842924
Hi

Sub Main()
  Dim WshShell As Object
  Dim sCmd As String
  sCmd = Command$
  Set WshShell = CreateObject("WScript.Shell")
  WshShell.RegWrite "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings\ProxyServer", sCmd
'No need to use release_all, renew_all should be enough
  WshShell.Run "%windir%\winipcfg /renew_all", 0
  t = Timer
  While t + 1 > Timer
  Wend
  SendKeys "{Enter}", True
  Set WshShell = Nothing
End Sub

'Compile this and call:
Project1.exe ProxyName:Port
'For example:
Project1.exe 192.168.0.5:8080
'or
Project1.exe seagate:80
0
 
LVL 4

Author Comment

by:oumer
ID: 6844013
As I promised, I have increased the points to 250. I have modified it a little an now I have a program that I can run like
ProxySet ip1 proxy1 ip2 proxy2 .....
so that when I change your laptop from place to place I have to set nothing (currently I use my laptop at home and school)

Thank you
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question