Solved

Setting internet proxy setting

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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

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…
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.
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 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…

737 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