> > ...but my first problem is Winhttp.h. I can't find it. I've searched
> > from C:\ for it.
>
> Do I need to install "Microsoft ® Windows Server® 2003 R2 Platform SDK" to
> get Winhttp.h?
Howdy Ben!
Thnaks for the reply!
> > >...but my first problem is Winhttp.h. I can't find it. I've
> > > searched from C:\ for it.
[quoted text clipped - 3 lines]
>
> That's definitely worth a try.
Yeah, I installed it and found out that it contained all I needed and I
was able to make a test program that did what I needed. Unfortunately, I
wasn't able to convert the VC++ lib to a lib that could be used by the
(very old) Borland environment used in the rest of the project. The lib
conversion tool couldn't handle it...
> Worst case, you could cut+paste the declarations yourself, I'd
> wouldn't prefer that, but for only four functions it isn't so bad.
Well, I did a little bit of this and that:
After having gotten familiar with the WinHttp* functions in VC++, I
found someone who'd made a "bccSDK" (Borland specific SDK) out of
winhttp.lib and all the rest. Unfortunately the include files he'd made
wasn't useful in the old BCB environment but when I had almost ported
the original files myself, I found someone who'd made most of that too.
I just had to add one #define. :-)
I've now made a first beta version of a AutoProxy lib (and class) for
BCB4 and so far it seems to be working like a charm.
Things still in the works:
* WinHttpGetProxyForUrl() can't handle anything else but http(s) calls.
Why? Is there a more "universal" GetProxyForUrl() somewhere?
* WinHttpGetProxyForUrl.lpszAutoConfigUrl can't handle pac files given
as a UNC path. Any special reason for that? IE handles that just fine.
My (temporary) solution is to set up an http server and to give that
server as "lpszAutoConfigUrl" instead. When I get a connection request,
I just feed the caller the file found at the UNC path. Is that how IE
does it too or is it a smarter, less resource consuming, way?
* Precedence: Although I think I've figured out in which order IE uses
the settings, it'd be nice with a facit.
* Testing WinHttpGetProxyForUrl() without feeding it a
lpszAutoConfigUrl: Two days ago I didn't know that there was a "WPAD
protocol" and I haven't figured out what I need to do to set my LAN up
like it would be in a real corporate network.
* What happens if programs using WinHttp* are executed in W98 etc.? If
the calls to those functions just returns with an error I'd be happy,
but if the programs crashes, I would not :-)
Best regards,
Ted Lyngmo
Ben Voigt [C++ MVP] - 02 Oct 2007 21:49 GMT
> * What happens if programs using WinHttp* are executed in W98 etc.? If the
> calls to those functions just returns with an error I'd be happy, but if
> the programs crashes, I would not :-)
You would need to use LoadLibrary and GetProcAddress to test for the
presence of those functions, instead of using the import library.
GetProcAddress will return NULL if the function does not exist.
> Best regards,
> Ted Lyngmo