Solved

Setting internet proxy setting

Posted on 2002-03-05
2
154 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
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: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

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

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

829 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