const int INTERNET_OPEN_TYPE_PRECONFIG = 0; // use registry configuration
const int INTERNET_OPEN_TYPE_DIRECT = 1; // direct to net
const int INTERNET_OPEN_TYPE_PROXY = 3; // via named proxy
const int INTERNET_OPEN_TYPE_PRECONFIG_WITH_NO_AUTOPROXY = 4; // prevent using java/script/INS
[DllImport("wininet.dll", SetLastError=true, CharSet=CharSet.Auto)]
static extern IntPtr InternetOpen(
string lpszAgent, int dwAccessType, string lpszProxyName,
string lpszProxyBypass, int dwFlags);
Const INTERNET_OPEN_TYPE_PRECONFIG = 0 ' // use registry configuration
Const INTERNET_OPEN_TYPE_DIRECT = 1 ' // direct to net
Const INTERNET_OPEN_TYPE_PROXY = 3 ' // via named proxy
Const INTERNET_OPEN_TYPE_PRECONFIG_WITH_NO_AUTOPROXY = 4 ' // prevent using java/script/INS
Declare Function InternetOpen Lib "wininet.dll" Alias "InternetOpenA" ( _
ByVal sAgent As String, _
ByVal lAccessType As Int32, _
ByVal sProxyName As String, _
ByVal sProxyBypass As String, _
ByVal lFlags As Integer) As Int32
sAgent can be any string, it is just to identify the connection
Using INTERNET_OPEN_TYPE_PRECONFIG as lAccessType, InternetOpen
uses the proxy specifications of Internet Explorer, useful if you
are behind a proxy firewall which uses dynamic proxy script
None.
Please add some!
C# Sample:
IntPtr hInternet = InternetOpen("browser", INTERNET_OPEN_TYPE_DIRECT, null, null, 0);
if (IntPtr.Zero == hInternet)
{
Console.WriteLine("InternetOpen returned null.");
return;
}
Console.WriteLine("InternetOpen succeeded.");
VB Sample:
Dim hInet As Int32 = InternetOpen(HttpAgent, INTERNET_OPEN_TYPE_PRECONFIG, _
vbNullString, vbNullString, 0)
If hInet = 0 Then Return False
Do you know one? Please contribute it!