Microsoft Windows CE 3.0  

CloseHandle

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 closes an open object handle. A remote application interface (RAPI) version of this function exists, named CeCloseHandle.

BOOL
CloseHandle(
HANDLE
hObject
);

Parameters

hObject
Handle to an open object.

Return Values

Nonzero indicates success. Zero indicates failure. To get extended error information, call GetLastError.

Remarks

The CloseHandlefunction closes handles to the following objects:

Communications device Mutex
Database Process
Event Socket
File Thread
File-Mapping Object Database enumeration context

CloseHandleinvalidates the specified object handle, decrements the object's handle count, and performs object retention checks. After the last handle to an object is closed, the object is removed from the system. Persistent objects such as databases and files will remain in storage, but must be re-opened to be accessed again.

Closing a thread handle does not terminate the associated thread. To remove a thread object, you must terminate the thread, then close all handles to the thread.

Use CloseHandleto close handles returned by calls to the CreateFilefunction. Use FindCloseto close handles returned by calls to the FindFirstFilefunction.

Requirements

Runs on Versions Defined in Include Link to
Windows CE OS 1.0 and later Winbase.h   Coredll.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

CreateFile, CreateFileForMapping, CreateFileMapping, CeFindFirstDatabaseEx , DeleteFile, FindClose, FindFirstFile, GetLastError