Compartir a través de


InternetOpen (Windows Embedded CE 6.0)

1/6/2010

This function initializes an application's use of the WinInet functions.

Syntax

HINTERNET WINAPI InternetOpen(
  LPCTSTR lpszAgent, 
  DWORD dwAccessType, 
  LPCTSTR lpszProxy, 
  LPCTSTR lpszProxyBypass, 
  DWORD dwFlags
);

Parameters

  • lpszAgent
    [in] Long pointer to a null-terminated string 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
    [in] Specifies the type of access required. The following table shows the possible values. This parameter is one of these values.

    Value Description

    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

    Not Supported. Autoproxy is not supported at the WinInet level.

    INTERNET_OPEN_TYPE_PROXY

    Passes requests to the proxy.

  • lpszProxy
    [in] Long pointer to a null-terminated string that contains the name of the proxy server, or list of servers, to use if proxy access was specified. If this parameter is NULL, the function reads proxy information from the registry. Do not use an empty string, because InternetOpen will use it as the proxy name. The WinInet functions only recognize CERN type proxies (HTTP only) and the TIS FTP gateway (FTP only). If Microsoft Internet Explorer is installed, the WinInet functions also support SOCKS proxies. FTP requests can be made through a CERN type proxy either by changing them to an HTTP request or by using InternetOpenUrl.
  • lpszProxyBypass
    [in] Pointer to a null-terminated string that specifies 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 that string 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 NULL.
  • dwFlags
    [in] Specifies one or more of the following values.

    Value Description

    INTERNET_FLAG_ASYNC

    Makes only asynchronous requests on handles descended from the handle returned from this function.

    INTERNET_FLAG_FROM_CACHE

    Does not make network requests. All entities are returned from the cache. If the requested item is not in the cache, a suitable error, such as ERROR_FILE_NOT_FOUND, is returned.

    INTERNET_FLAG_OFFLINE

    Identical to INTERNET_FLAG_FROM_CACHE. Does not make network requests. All entities are returned from the cache. If the requested item is not in the cache, a suitable error, such as ERROR_FILE_NOT_FOUND, is returned.

Return Value

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

Remarks

InternetOpen is the first WinInet 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 usually sufficient. The application might need to have separate behaviors defined for each InternetOpen instance, such as different proxy servers configured for each.

Requirements

Header wininet.h
Library wininet.lib
Windows Embedded CE Windows CE 2.0 and later

See Also

Reference

WinInet Functions
InternetCloseHandle
InternetOpenUrl
InternetQueryDataAvailable
InternetReadFile