hSession := InternetOpen('
User', INTERNET_OPEN_TYPE_PRECONFIG,
nil,
nil, 0);
InternetSetOption(hSession, INTERNET_OPTION_CONNECT_TIMEOUT, ...
InternetSetOption(hSession, INTERNET_OPTION_SEND_TIMEOUT, ...
InternetSetOption(hSession, INTERNET_OPTION_RECEIVE_TIMEOUT, ...
InternetSetOption(hSession, INTERNET_OPTION_DATA_SEND_TIMEOUT, ...
InternetSetOption(hSession, INTERNET_OPTION_DATA_RECEIVE_TIMEOUT, ...
InternetSetOption(hSession, INTERNET_OPTION_DISCONNECTED_TIMEOUT, ...
hURL := InternetOpenURL(hSession, PChar(
URL),
nil, 0, 0, 0);
Try
...
If not InternetReadFile(hURL, @Buffer[1], BufferSize, BufferLength)
Then
...
Finally
InternetCloseHandle(hURL);
InternetCloseHandle(hSession);
End;