Search
Module:
Directory

   Desktop Functions:

   Smart Device Functions:


Show Recent Changes
Subscribe (RSS)
Misc. Pages
Comments
FAQ
Helpful Tools
Playground
Suggested Reading
Website TODO List
Download Visual Studio Add-In

InternetOpen (wininet)
 
.
Summary
TODO - a short description

C# Signature:

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);

VB Signature:

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

Notes:

  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.

Tips & Tricks:

Please add some!

Sample Code:

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

Alternative Managed API:

Do you know one? Please contribute it!

Documentation

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).

 
Access PInvoke.net directly from VS:
Terms of Use
Edit This Page
Find References
Show Printable Version
Revisions