Microsoft Windows CE 3.0  

InternetOpen

Important:
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.

This function initializes an application's use of the Windows CE Internet functions.

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

Parameters

lpszAgent
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
Specifies the type of access required. It is one of the following 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 Retrieves the proxy or direct configuration from the registry and prevents the use of a startup JScript 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.
lpszProxy
Long pointer to a null-terminated string that contains the name of the proxy server (or 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 InternetOpenwill use it as the proxy name. The Win32 Internet functions only recognize CERN type proxies (HTTP only) and the TIS FTP gateway (FTP only). If Microsoft Internet Explorer is installed, the Win32 Internet 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
Long pointer to a null-terminated string that contains an optional list of host names or IP addresses, or both, that should not be routed through the proxy. The list can contain wildcards. Do not use an empty string, because InternetOpenwill 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 this parameter is NULL, the function reads the bypass list from the registry.
dwFlags
Specifies various options affecting the behavior of the function. It can be a combination of these values:
  • INTERNET_FLAG_ASYNC
  • INTERNET_FLAG_FROM_CACHE
  • INTERNET_FLAG_OFFLINE
  • INTERNET_INVALID_PORT_NUMBER

    Specifying INTERNET_INVALID_PORT_NUMBER is the same as specifying the default port number.

    Return Values

    A valid handle, which the application passes on to subsequent Win32 Internet functions, indicates success. NULL indicates failure. To get extended error information, call GetLastError.

    Windows CE Remarks

    The InternetOpenfunction makes available most of the functionality of the corresponding Win32 Internet function, including basic direct connections, proxy connections, and pre-configuration proxy settings. The type of internet access is specified by one of the three values assigned to the inparameter, dwAccessType:

    INTERNET_OPEN_TYPE_DIRECT
    Requests are made directly to the nominated server.
    INTERNET_OPEN_TYPE_PROXY
    Request are made through the nominated proxy.
    INTERNET_OPEN_TYPE_PRECONFIG
    Gets configuration from the registry. InternetOpenlooks under the HKEY_CURRENT_USER\Comm\Wininet\ProxyServer key to determine the proxy configuration to use. If this key does not exist, or the string is NULL, all requests will be made directly to the nominated server. The string stored in the key must be in the form [<protocol>=][<scheme>://]<proxy>[:<port>].If the proxy server list is not registered in the registry or the string is NULL, Windows CE defaults to the INTERNET_OPEN_TYPE_DIRECT access.

    Windows CE does not support multiple proxy servers. Thus, only one proxy can be specified for lpszProxyin the form: [<protocol>=][<scheme>://]<proxy>[:<port>] For example, "http://proxy:80" is allowed, but "ftp=ftp://ftp-gw http=http://jerhico:80" is not.

    Windows CE does not support the proxy bypass lists; the lpszProxyBypassparameter must be NULL.

    An application can accept the INTERNET_FLAG_ASYNC value for the dwFlagsparameter, but only the InternetReadFileand InternetQueryDataAvailablefunctions can execute asynchronously. All other requests will be completed synchronously. However, it does not take the INTERNET_FLAG_OFFLINE flag as no caching features are available.

    Remarks

    InternetOpenis 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 InternetCloseHandleto 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 InternetOpeninstance, such as different proxy servers configured for each.

    Requirements

    Runs on Versions Defined in Include Link to
    Windows CE OS 2.0 and later Wininet.h   Wininet.lib
    Note   This API is part of the complete Windows CE OS package as provided by Microsoft. The functionality of a particular platform is determined by the original equipment manufacturer (OEM) and some devices may not support this API.

    See Also

    GetLastError, InternetCloseHandle, InternetOpenUrl, InternetQueryDataAvailable, InternetReadFile