Solved

Setting internet proxy setting

Posted on 2002-03-05
2
151 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 27

Accepted Solution

by:
Ark earned 250 total points
Comment Utility
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
Comment Utility
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

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…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

763 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

Need Help in Real-Time?

Connect with top rated Experts

6 Experts available now in Live!

Get 1:1 Help Now