Solved

Internet Explorer Proxy Settings

Posted on 2003-10-22
17
1,651 Views
Last Modified: 2008-02-01
I need to be able to programmatically change the proxy server values in internet explorer, for LAN,
and dialup.

I would prefer no registry hacks thanks! need that uses InternetSetOption ...

I say this only because of risk issues associated with corrupting peoples registries, I have heard some horror stories
about moding these particular settings in the registry...

Anyone got any code to do this using "InternetSetOption" api calls?

Thanks...

P.S. there is an artical here in C++ but I have no idea how to convert it :-)

http://support.microsoft.com/default.aspx?scid=http://support.microsoft.com:80/support/kb/articles/q226/4/73.asp&NoWebContent=1
0
Comment
Question by:NeXus
[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
  • 5
  • 5
  • 2
  • +3
17 Comments
 
LVL 1

Author Comment

by:NeXus
ID: 9604416
Ok whacked it up some, points wise, I feel this is a tricky / undocumented area
0
 
LVL 7

Expert Comment

by:_agj_
ID: 9604593
0
 
LVL 8

Expert Comment

by:harris_c
ID: 9604606
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 7

Expert Comment

by:_agj_
ID: 9604614
0
 
LVL 1

Author Comment

by:NeXus
ID: 9604661

>_agi_ suggested http://www.vbip.com/wininet/wininet_connection_02.asp 
...  nothing here about proxies or here: http://www.vbip.com/wininet

>harris_c said: http://www-tcsn.experts-exchange.com/Programming/Programming_Languages/Visual_Basic/Q_20680780.html
... saw this yesterday,  but this doesnt compile under VB6! plus I need to set the option permanently.

500 points up for grabs here boys n gurls! come on down!!!

how about some code?

NeXus

0
 
LVL 7

Expert Comment

by:_agj_
ID: 9605125
The first link is not a total zero, there is some general overview of the process, but nothing as to the SPECIFIC one.
0
 
LVL 1

Author Comment

by:NeXus
ID: 9605173
thanks, sure _agj_

but unfortunately nothing worth any points...
0
 
LVL 7

Expert Comment

by:_agj_
ID: 9605175
Try (reuse this code):

Option Explicit

Private Type INTERNET_PROXY_INFO
    dwAccessType    As Long
    lpszProxy       As String
    lpszProxyBypass As String
End Type

Private Const ERROR_INSUFFICIENT_BUFFER = 122
Private Const INTERNET_OPTION_PROXY = 38
Private Const INTERNET_OPEN_TYPE_DIRECT = 1
Private Const INTERNET_OPEN_TYPE_PROXY = 3

Private Declare Function InternetSetOption Lib "wininet.dll" Alias "InternetSetOptionA" (ByVal hInternet As Long, ByVal dwOption As Long, ByRef lpBuffer As Any, ByVal dwBufferLength As Long) As Long

'On form add a command1 button


Private Sub Command1_Click()
   
    Dim iRet As Long
    Dim ProxyInfo As INTERNET_PROXY_INFO
   

        ProxyInfo.dwAccessType = INTERNET_OPEN_TYPE_PROXY
        ProxyInfo.lpszProxy = ("http=127.0.0.1:8080")
        ProxyInfo.lpszProxyBypass = "<local>"

   
    iRet = InternetSetOption(0&, INTERNET_OPTION_PROXY, ProxyInfo, LenB(ProxyInfo))
    '
    If iRet <> 0 Then
      MsgBox "Now Using Proxy Service.", vbInformation
        Else
      MsgBox "Error in Setting IE Proxy Service.", vbInformation
       End If
   
End Sub
0
 
LVL 7

Expert Comment

by:_agj_
ID: 9605179
The difference is in some declarations added n changed.
0
 
LVL 1

Author Comment

by:NeXus
ID: 9605271
Sorry that didnt work,

That may have changed the proxy settings temporarily, but I need them to visually change (and persist) in the internet explorer settings.

Thanks for the effort
:-)
0
 
LVL 26

Expert Comment

by:EDDYKT
ID: 9605926
0
 
LVL 26

Expert Comment

by:EDDYKT
ID: 9605930
ooppps that is c++ code but you should get the idea
0
 
LVL 16

Expert Comment

by:Richie_Simonetti
ID: 9606433
I think after you did the change to proxy setting should broadcast a message to the system to tell that it was... Changed.
0
 
LVL 1

Author Comment

by:NeXus
ID: 10306745
Not answered: get a refund thanks
0
 

Accepted Solution

by:
CetusMOD earned 0 total points
ID: 10652023
PAQed, with points refunded (500)

CetusMOD
Community Support Moderator
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

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

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
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…

733 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