이 질문은 : InternetSetOption은 어떻게 사용합니까?
Using Proxy with web browser control
는 "후에 InternetSetOption"를 사용하는 나에게 말했다. 어떻게 사용합니까? 코드로 어떻게 구현할 수 있습니까 (예?)?감사합니다.
이 질문은 : InternetSetOption은 어떻게 사용합니까?
Using Proxy with web browser control
는 "후에 InternetSetOption"를 사용하는 나에게 말했다. 어떻게 사용합니까? 코드로 어떻게 구현할 수 있습니까 (예?)?감사합니다.
public struct Struct_INTERNET_PROXY_INFO
{
public int dwAccessType;
public IntPtr proxy;
public IntPtr proxyBypass;
}
[DllImport("wininet.dll", SetLastError = true)]
private static extern bool InternetSetOption(
IntPtr hInternet,
int dwOption,
IntPtr lpBuffer,
int lpdwBufferLength);
private void RefreshIESettings(string strProxy)
{
const int INTERNET_OPTION_PROXY = 38;
const int INTERNET_OPEN_TYPE_PROXY = 3;
Struct_INTERNET_PROXY_INFO struct_IPI;
struct_IPI.dwAccessType = INTERNET_OPEN_TYPE_PROXY;
struct_IPI.proxy = Marshal.StringToHGlobalAnsi(strProxy);
struct_IPI.proxyBypass = Marshal.StringToHGlobalAnsi("local");
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));
}
private void Usage()
{
RefreshIESettings("1.2.3.4:8080");
object nullObject = 0;
string strTemp = "";
object nullObjStr = strTemp;
axWebBrowser1.Navigate("http://test.com", ref nullObject, ref nullObjStr, ref nullObjStr, ref nullObjStr);
}
제발, @Jacob. 원하는 답을 얻을 수 없을 때마다 새로운 질문을하지 않고 질문을 수정하고 더 좋아지게 만듭니다. 이 질문에 변종을 적어도 5 번 이상 물어 봤습니다. –
가능한 복제본 : http://stackoverflow.com/questions/6352780/using-a-proxy-in-c-webbrowser –
가능한 복제본 : http://stackoverflow.com/questions/6247368/how-do-i-access -registry-c-for-a-proxy –