Different proxy for different threads
- From: Mures <wmures@xxxxxxxxx>
- Date: Mon, 21 Apr 2008 13:20:23 -0700 (PDT)
Good day,
I'm trying to use different proxies for different threads (a proxy per
thread), but it doesn't seem to work.
According to Microsoft KB http://support.microsoft.com/kb/226473 :
"Note INTERNET_OPTION_PROXY does not permanently change the settings.
It does this for the current process only when a NULL handle is used."
And it seems to work for different processes (I'm using
InternetSetOption with C# like this:
[code]
public void ChangeIEProxy(string strProxy)
{
const int INTERNET_OPTION_PROXY = 38;
const int INTERNET_OPEN_TYPE_PROXY = 3;
Struct_INTERNET_PROXY_INFO struct_IPI;
// Filling in structure
struct_IPI.dwAccessType = INTERNET_OPEN_TYPE_PROXY;
struct_IPI.proxy = Marshal.StringToHGlobalAnsi(strProxy);
struct_IPI.proxyBypass =
Marshal.StringToHGlobalAnsi("local");
// Allocating memory
IntPtr intptrStruct =
Marshal.AllocCoTaskMem(Marshal.SizeOf(struct_IPI));
// Converting structure to IntPtr
Marshal.StructureToPtr(struct_IPI, intptrStruct, true);
bool iReturn = InternetSetOption(IntPtr.Zero,
INTERNET_OPTION_PROXY, intptrStruct, Marshal.SizeOf(struct_IPI));
}
[/code]
My question: how can I use multiple proxies with multiple threads?
Thank you.
Mures
.
- Prev by Date: Re: mouse clicked Area from C# DOM
- Next by Date: DXImageTransform.Microsoft.AlphaImageLoader with asynchronous pluggable protocol
- Previous by thread: How to print currently open webpage from IE add-in?
- Next by thread: DXImageTransform.Microsoft.AlphaImageLoader with asynchronous pluggable protocol
- Index(es):