Click to return to the Networking, Protocols     
InternetCheckConnection F...     InternetConfirmZoneCrossi...     General Win32 Internet Fu...    
Web Workshop  |  Networking, Protocols & Data Formats

InternetCloseHandle Function


Closes a single Internet handle.

Syntax

BOOL InternetCloseHandle(
    IN HINTERNET hInternet
);

Parameters

hInternet
Valid HINTERNET handle to be closed.

Return Value

Returns TRUE if the handle is successfully closed, or FALSE otherwise. To get extended error information, call GetLastError.

Remarks

The function terminates any pending operations on the handle and discards any outstanding data. If a thread is blocking a call to Wininet.dll, another thread in the application can call InternetCloseHandle on the Internet handle being used by the first thread to cancel the operation and unblock the first thread.

If there is a status callback registered for the handle being closed and the handle was created with a non-NULL context value, an INTERNET_STATUS_HANDLE_CLOSING callback will be made. This indication will be the last callback made from a handle and indicates that the handle is being destroyed.

If asynchronous requests are pending for the handle or any of its child handles, the handle cannot be closed immediately, but it will be invalidated. Any new requests attempted using the handle will return with an ERROR_INVALID_HANDLE notification. The asynchronous requests will complete with INTERNET_STATUS_REQUEST_COMPLETE. Applications must be prepared to receive any INTERNET_STATUS_REQUEST_COMPLETE indications on the handle before the final INTERNET_STATUS_HANDLE_CLOSING indication is made, which indicates that the handle is completely closed.

An application can call GetLastError to determine if requests are pending. If GetLastError returns ERROR_IO_PENDING, there were outstanding requests when the handle was closed.

Function Information

Windows NT Use version 4.0. Implemented only as an ANSI function.
Windows Use Windows 95 and later. Implemented only as an ANSI function.
Header Wininet.h
Import library Wininet.lib
Minimum availability Internet Explorer 3.0

Windows CE

Windows CE Use version 2.12 and later
Minimum availability Internet Explorer 4.0

See Also

Microsoft Win32 Internet Functions Overview, Enabling Internet Functionality, Microsoft Win32 Internet Functions Reference, General Win32 Internet Functions, FtpFindFirstFile, FtpOpenFile, GopherFindFirstFile, HttpOpenRequest, InternetConnect



Back to topBack to top

Did you find this topic useful? Suggestions for other topics? Write us!

© 1999 Microsoft Corporation. All rights reserved. Terms of use.