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

InternetQueryOption (wininet)
 
.
Summary
Used to query Windows' current Internet proxy settings.

C# Signature:

[DllImport("wininet.dll", SetLastError=true)]
static extern bool InternetQueryOption(IntPtr hInternet, uint dwOption, char[] lpBuffer, ref int lpdwBufferLength);

VB Signature:

<DllImport("wininet.dll", SetLastError:=True)> Shared Function InternetQueryOption(ByVal hInternet As IntPtr, ByVal dwOption As UInteger, ByVal  lpBuffer() As Char, ByRef lpdwBufferLength As Integer) As Boolean

End Function

Declare Function InternetQueryOption Lib "wininet.dll" (TODO) As TODO

User-Defined Types:

None.

Notes:

In order to set new proxy settings use InternetSetOption.

Tips & Tricks:

Please add some!

Sample Code:

Please add some!

Retrieve WinInet version in C#:

const int INTERNET_OPTION_VERSION = 40;

[StructLayout(LayoutKind.Sequential)]
public struct INTERNET_VERSION_INFO
{
     public int dwMajorVersion;
     public int dwMinorVersion;
};

// Note that I named the imported fcn "InternetQueryVersion" due to custom arg signature
[DllImport("wininet.dll", EntryPoint = "InternetQueryOption")]
private extern static bool InternetQueryVersion(int Handle, int OptionFlag, ref INTERNET_VERSION_INFO Version, ref int size);

INTERNET_VERSION_INFO Version = new INTERNET_VERSION_INFO();
int size = Marshal.SizeOf(Version);
bool r = InternetQueryVersion(0, INTERNET_OPTION_VERSION, ref Version, ref size);

Alternative Managed API:

Do you know one? Please contribute it!

Documentation

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wininet/wininet/internetqueryoption.asp

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