Microsoft HomeproductssearchsupportshopWrite Us   Microsoft Home
Magazine
 |  Community
 |  Workshop
 |  Tools & Samples
 |  Training
 |  Site Info

Workshop  |  Networking, Protocols & Data Formats

InternetOpen Function


Initializes an application's use of the Win32® Internet functions.

Syntax

HINTERNET InternetOpen%(
    IN LPCTSTR% lpszAgent,
    IN DWORD dwAccessType,
    IN LPCTSTR% lpszProxyName,
    IN LPCTSTR% lpszProxyBypass,
    IN DWORD dwFlags
);

The actual syntax of this function varies between its ANSI and Unicode implementations. See the Win32 Internet Functions Syntax document for details.

Parameters

lpszAgent
Address of a string variable that contains the name of the application or entity calling the Internet functions (for example, Microsoft® Internet Explorer). This name is used as the user agent in the HTTP protocol.
dwAccessType
Type of access required. Can be one of the following values:
INTERNET_OPEN_TYPE_DIRECT
Resolves all host names locally.
INTERNET_OPEN_TYPE_PRECONFIG
Retrieves the proxy or direct configuration from the registry.
INTERNET_OPEN_TYPE_PRECONFIG_WITH_NO_AUTOPROXY
Retrieves the proxy or direct configuration from the registry and prevents the use of a startup JScript® (compatible with ECMA 262 language specification) or Internet Setup (INS) file.
INTERNET_OPEN_TYPE_PROXY
Passes requests to the proxy unless a proxy bypass list is supplied and the name to be resolved bypasses the proxy. In this case, the function uses INTERNET_OPEN_TYPE_DIRECT.
lpszProxyName
Address of a string variable that contains the name of the proxy server(s) to use when proxy access is specified by setting dwAccessType to INTERNET_OPEN_TYPE_PROXY. Do not use an empty string, because InternetOpen will use it as the proxy name. The Win32 Internet functions recognize only CERN type proxies (HTTP only) and the TIS FTP gateway (FTP only). If Internet Explorer is installed, the Win32 Internet functions also support SOCKS proxies. FTP and Gopher requests can be made through a CERN type proxy either by changing them to an HTTP request or by using InternetOpenUrl. If dwAccessType is not set to INTERNET_OPEN_TYPE_PROXY, this parameter is ignored and should be set to NULL. For more information about listing proxy servers, see Listing Proxy Servers section of the Enabling Internet Functionality article.
lpszProxyBypass
Address of a string variable that contains an optional list of host names or IP addresses, or both, that should not be routed through the proxy when dwAccessType is set to INTERNET_OPEN_TYPE_PROXY. The list can contain wildcards. Do not use an empty string, because InternetOpen will use it as the proxy bypass list. If this parameter specifies the "<local>" macro as the only entry, the function bypasses any host name that does not contain a period. If dwAccessType is not set to INTERNET_OPEN_TYPE_PROXY, this parameter is ignored and should be set to NULL.
dwFlags
Unsigned long integer value that contains the flags that indicate various options affecting the behavior of the function. This can be a combination of these values:
INTERNET_FLAG_ASYNC
INTERNET_FLAG_FROM_CACHE
INTERNET_FLAG_OFFLINE

Return Value

Returns a valid handle that the application passes on to subsequent Win32 Internet functions. If InternetOpen fails, it returns NULL. To get a specific error message, call GetLastError.

Remarks

InternetOpen is the first Win32 Internet function called by an application. It tells the Internet DLL to initialize internal data structures and prepare for future calls from the application. When the application finishes using the Internet functions, it should call InternetCloseHandle to free the handle and any associated resources.

The application can make any number of calls to InternetOpen, although a single call is normally sufficient. The application might need to have separate behaviors defined for each InternetOpen instance, such as different proxy servers configured for each.

Function Information

Windows NT Use version 4.0 and later. Implemented as ANSI and Unicode functions.
Windows Use Windows 95 and later. Implemented as ANSI and Unicode functions.
Header Wininet.h
Import library Wininet.lib
Minimum availability Internet Explorer 3.0 (ANSI only), 5 (ANSI and Unicode)

See Also

Microsoft Win32 Internet Functions Overview, Enabling Internet Functionality, Microsoft Win32 Internet Functions Reference, General Win32 Internet Functions


Does this content meet your programming needs? Write us!

Back to topBack to top

© 1998 Microsoft Corporation. All rights reserved. Terms of use.

 

Magazine Home
Ask Jane
DHTML Dude
Extreme XML
For Starters
More or Hess
Servin' It Up
Site Lights
Web Men Talking
Member Community Home
Benefits: Freebies & Discounts
Benefits: Promote Your Site
Benefits: Connect with Your Peers
Benefits at a Glance
Online Special-Interest Groups
Your Membership
SBN Stores
Join Now
Workshop Home
Essentials
Content & Component Delivery
Component Development
Data Access & Databases
Design
DHTML, HTML & CSS
Extensible Markup Language (XML)
Languages & Development Tools
Messaging & Collaboration
Networking, Protocols & Data Formats
Reusing Browser Technology
Security & Cryptography
Server Technologies
Streaming & Interactive Media
Web Content Management
Workshop Index
Tools & Samples Home
Tools
Samples, Headers, Libs
Images
Sounds
Style Sheets
Web Fonts
Training Home
SBN Live Seminars
SBN Live Chats
Courses
Peer Support
CD-ROM Training
Books & Training Kits
Certification
SBN Home
New to SBN?
What's New on SBN
Site Map
Site Search
Glossary
Write Us
About This Site