Windows Internet (WinINet) Functions

Reference documentation for the WinINet API.

Overview of WinINet Functions

The WinINet API provides high-level access to the HTTP protocol and facilitates Internet operations. It is designed to be user-friendly and provides functions for various Internet tasks such as establishing FTP and HTTP sessions, retrieving data, and managing Internet options.

This section lists and describes the various functions available within the WinINet API. Each function's description includes its syntax, parameters, return values, and remarks, along with example code where applicable.

Core Functions

InternetOpen

Initializes the WinINet library for application use.

View Details → LPCTSTR lpszAgent, DWORD dwAccessType, LPCTSTR lpszProxyName, LPCTSTR lpszProxyBypass, DWORD dwFlags

InternetOpenUrl

Opens a connection to the specified Internet resource.

View Details → HINTERNET InternetOpenUrl(HINTERNET hInternet, LPCTSTR lpszUrl, LPCTSTR lpszHeaders, DWORD dwHeadersLength, DWORD dwFlags, DWORD_PTR dwContext)

InternetConnect

Establishes a connection to the specified Internet server.

View Details → HINTERNET InternetConnect(HINTERNET hInternet, LPCTSTR lpszServerName, INTERNET_PORT nServerPort, LPCTSTR lpszUsername, LPCTSTR lpszPassword, DWORD dwService, DWORD dwFlags, DWORD_PTR dwContext)

HttpOpenRequest

Creates an HTTP request handle.

View Details → HINTERNET HttpOpenRequest(HINTERNET hConnect, LPCTSTR lpszVerb, LPCTSTR lpszObjectName, LPCTSTR lpszVersion, LPCTSTR lpszReferer, LPCTSTR* lplpszAcceptTypes, DWORD dwFlags, DWORD_PTR dwContext)

HttpSendRequest

Sends the HTTP request to the specified server.

View Details → BOOL HttpSendRequest(HINTERNET hRequest, LPCTSTR lpszHeaders, DWORD dwHeadersLength, LPVOID lpOptional, DWORD dwOptionalLength)

InternetReadFile

Reads data from the specified Internet handle.

View Details → BOOL InternetReadFile(HINTERNET hFile, LPVOID lpBuffer, DWORD dwNumberOfBytesToRead, LPDWORD lpdwNumberOfBytesRead)

InternetCloseHandle

Closes the specified Internet handle.

View Details → BOOL InternetCloseHandle(HINTERNET hInternet)

Other Notable Functions

InternetSetOption

Sets an Internet option for the application.

View Details → BOOL InternetSetOption(HINTERNET hInternet, DWORD dwOption, LPVOID lpBuffer, DWORD dwBufferLength)

InternetQueryOption

Retrieves an Internet option for the application.

View Details → BOOL InternetQueryOption(HINTERNET hInternet, DWORD dwOption, LPVOID lpBuffer, LPDWORD lpdwBufferLength)

FtpOpenFile

Opens a file on the FTP server.

View Details → HINTERNET FtpOpenFile(HINTERNET hFtpSession, LPCTSTR lpszFileName, DWORD dwAccess, DWORD dwAttributes, DWORD dwFlags, DWORD_PTR dwContext)

GopherOpenFile

Opens a file on the Gopher server.

View Details → HINTERNET GopherOpenFile(HINTERNET hGopherSession, LPCTSTR lpszFileName, DWORD dwAccess, DWORD dwAttributes, DWORD dwFlags, DWORD_PTR dwContext)