Our application uses libcurl for HTTP, and we want to get access to Internet Explorer's proxy settings. An earlier Stack Overflow question recommends that we use WinHttpGetIEProxyConfigForCurrentUser
and WinHttpGetProxyForUrl
.
Unfortunately, the winhttp.h
header does not appear to be included with our copies either Visual C++ 2005 or Visual Studio 2008. Apparently, it's possible to download an updated Platform SDK and install it in Visual C++ 2005, but it's a pretty painful process, and it doesn't necessarily work with newer versions of Visual Studio.
Is there a good, well-supported way to access the WinHTTP 5.1 APIs from C++? Or should we avoid using these APIs?
The best, well-supported way to access the WinHTTP 5.1 APIs from C++ is via the Windows SDK (new name for the Platform SDK) and using those APIs you mentioned.
The article you linked to suggests that installing the SDK is difficult - the good news is its an old article from 2006 and things are much easier these days. Just do the following:
You may even be prompted to run the integration tool during installation - it's been a while since I installed it so I can't recall exactly.
The Visual C++ compiler will then be able to find winhttp.h and winhttp.lib in the appropriate folders.
Update As usual things are never as simple as they should be. EMK has pointed out that the Windows SDK Configuration Tool doesn't work properly with Visual Studio 2008 (any version) and crashes after installing Visual Studio 2008 SP1. Details and workarounds are reported here and here.