Type a page name and press Enter. You'll jump to the page if it exists, or you can create it if it doesn't.
To create a page in a module other than wininet, prefix the name with the module name and a period.
InternetQueryOption (wininet)
.
C# Signature:
[DllImport("wininet.dll", SetLastError = true)]
private static extern bool InternetQueryOption(
IntPtr hInternet, //Handle on which to query information.
int dwOption, //Internet option to be queried.
IntPtr lpBuffer, //Pointer to a buffer that receives the option setting.
ref int lpdwBufferLength//Pointer to a variable that contains the size of lpBuffer, in bytes.
);
VB Signature:
Declare Function InternetQueryOption Lib "wininet.dll" (TODO) As TODO
User-Defined Types:
public struct Struct_INTERNET_PROXY_INFO
{
public int dwAccessType;//Access type.
public IntPtr proxy;//Pointer to a string that contains the proxy server list
public IntPtr proxyBypass;//Pointer to a string that contains the proxy bypass list.
};
if ((Marshal.GetLastWin32Error() == ERROR_INSUFFICIENT_BUFFER) || iReturn )
{
// Allocating memory
intptrStruct = Marshal.AllocCoTaskMem(bufferLength);
if (intptrStruct != IntPtr.Zero)
{
iReturn = InternetQueryOption(IntPtr.Zero, INTERNET_OPTION_PROXY, intptrStruct, ref bufferLength);
if (iReturn)
{
struct_IPI = (Struct_INTERNET_PROXY_INFO)Marshal.PtrToStructure(intptrStruct , typeof(Struct_INTERNET_PROXY_INFO));
Console.WriteLine("*****Proxy Server Config*****");
foreach(string proxy in Marshal.PtrToStringAnsi(struct_IPI.proxy).Split(' '))
Console.WriteLine(proxy);
Console.WriteLine("\n*****Proxy Server Bypass List *****");
foreach(string proxyBypass in Marshal.PtrToStringAnsi(struct_IPI.proxyBypass).Split(' '))
Console.WriteLine(proxyBypass);
}
}
}else{
Console.WriteLine("ErrorCode={0}", Marshal.GetLastWin32Error());
}
}catch(Exception exp){
Console.WriteLine( exp.ToString());
}finally{
if (intptrStruct != IntPtr.Zero)
Marshal.FreeCoTaskMem(intptrStruct);
}
Alternative Managed API:
Do you know one? Please contribute it!
Please edit this page!
Do you have...
helpful tips or sample code to share for using this API in managed code?
corrections to the existing content?
variations of the signature you want to share?
additional languages you want to include?
Select "Edit This Page" on the right hand toolbar and edit it! Or add new pages containing supporting types needed for this API (structures, delegates, and more).