intelliproject logo

Location: Desktop development - C/C++    License: The Intelliproject Open License (IPOL)

How to change proxy settings under Internet Explorer using C++

Posted by Silviu Caragea

This article describe how can you change the Internet Explorer proxy settings on-the-fly using C++ and Win32 API.

Skill: Beginner

Posted: 14/12/2008

Views: 3704

Rating: 0.00 /5

Popularity: 0.00

Sign Up to vote for this article

Introduction

On the www you can find a lot of tools which helps you to quickly switch between different proxy servers while surfing the internet. Most of them allow you to change the Internet Explorer proxy settings on-the-fly, without having to go into the Properties dialog.

Manually you can change your IE proxy settings using the following steps:

  • Open Internet Explorer
  • From the Tools menu, choose Internet Options.
  • Click the Connections Tab
  • Click on Lan Settings button

Now you should have in front of your screen the following dialog box (this if you use IE7)

ie_proxy.JPG

  • Tick the box marked "Use a proxy server for your LAN ..."
  • In the Address field type your proxy address and in the Port field type your proxy port
  • Tick the box marked "Bypass proxy server for local addresses"
  • Click the "OK" button

In the following sections I will explain how to do all this things programmatically using C++.

Set proxy settings under Internet Explorer using Win 32 API

The idea is very simple. First of all we are building a connection options list and we set this options using InternetSetOption.

The following function takes two parameters. char *proxyAdressStr which represent the proxy server address and char * connNameStr which represent your connection name(in case you want to set the proxy for your LAN this should be set NULL).

Remove proxy settings under Internet Explorer using Win 32 API

The following function will remove your proxy settings for a specified connection name. In case you want to remove your LAN proxy settings set char *connectionNameStr as NULL.

Using this code

To use the functions described in this article you should include windows.h and wininet.h. Also you must link wininet.lib to your project.All these things can be done by adding the following three lines to your project:

License

This article, along with any associated source code and files, is licensed under The Intelliproject Open License (IPOL)

About the author

Silviu Caragea

Silviu Caragea is the Founder, Administrator and Chief Editor who wrote and runs The IntelliProject.

He's been programming since 2000 and now he's student at The Faculty of Economic Cybernetics, Statistics and Informatics from Bucharest. In the same time he's working as software developer at Cratima Software, a Romanian software and web design company that activates both on the local and foreign market, providing its customers with software development services, internet and intranet solutions, web design, graphic design and IT consultancy.

His programming experience includes:
- C,C++, Visual C++(Win32 API, MFC, ADO, STL, DAO, ODBC, ATL, COM, DirectShow, DirectDraw, WTL)
- Open Source libraries :CURL & Boost
- HTML, CSS
- Java (SE,ME)
- JavaScript, Ajax, Google Web Toolkit (GWT)
- Php, MySQL
-Oracle, PL SQL
- C# .NET
-Objective C, IPhone SDK, Cocoa

Location: Romania
Ocupation: Software Engineer
Home page: http://www.intelliproject.net

Posted by sa at 20/05/2011 23:04
hi . that is good and clear code but my friend
this code could not
"Tick the box marked "Bypass proxy server for local addresses"
as you said . you can solve it ?
i tried and i cant :(
tnx

Sign up to post message on the article message board!