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

WinHttpDetectAutoProxyUrl (winhttp)
 
.
Summary
Get pac url from DHCP or DNS.

C# Signature:

[DllImport("winhttp.dll", SetLastError = true, CharSet = CharSet.Unicode)]
[return: MarshalAs(UnmanagedType.Bool)]
public static extern Boolean WinHttpDetectAutoProxyConfigUrl(
    UInt32 dwAutoDetectFlags,
    [MarshalAs(UnmanagedType.LPWStr)] out String ppwstrAutoConfigUrl
);

VB Signature:

Declare Function WinHttpDetectAutoProxyUrl Lib "winhttp.dll" (TODO) As TODO

User-Defined Types:

None.

Alternative Managed API:

Do you know one? Please contribute it!

Notes:

Values for dwAutoDetectFlags :

    UInt32 WINHTTP_AUTO_DETECT_TYPE_DHCP = 0x00000001;
    UInt32 WINHTTP_AUTO_DETECT_TYPE_DNS_A = 0x00000002;

or both

    WINHTTP_AUTO_DETECT_TYPE_DHCP|WINHTTP_AUTO_DETECT_TYPE_DNS_A

If both the DHCP and DNS auto detect flags are set, DHCP is used first; if no PAC URL is discovered using DHCP, then DNS is used

Tips & Tricks:

Please add some!

Sample Code:

String result;
if ( ! Winhttp.WinHttpDetectAutoProxyConfigUrl(Winhttp.WINHTTP_AUTO_DETECT_TYPE_DHCP|Winhttp.WINHTTP_AUTO_DETECT_TYPE_DNS_A, out result))
    {
    UInt32 error = (uint)Marshal.GetLastWin32Error();
    System.Console.WriteLine("Error "+ error);
    }
System.Console.WriteLine(result);

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