This function initializes an application's use of the WinInet functions.
HINTERNET WINAPI InternetOpen( LPCTSTR lpszAgent, DWORD dwAccessType, LPCTSTR lpszProxy, LPCTSTR lpszProxyBypass, DWORD dwFlags );
[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.
[in] Specifies the type of access required. The following table shows the possible values. This parameter is one of these values.
Resolves all host names locally.
Retrieves the proxy or direct configuration from the registry.
Not Supported. Autoproxy is not supported at the WinInet level.
Passes requests to the proxy.
[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.
[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.
[in] Specifies one or more of the following values.
Makes only asynchronous requests on handles descended from the handle returned from this function.
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.
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.
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.
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.